摘要: How to use Spring cloud gateway 1. create a maven modele for the API gateway 2. add the dependency (Search "gateway" in the start.spring.io) into the 阅读全文
posted @ 2023-10-30 00:34 小白冲冲 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 一个服务可以拥有多个实例(Instance),每个实例会引用不同的ip地址。这种情况下,我们将无法知道应该访问哪个。所以我们就需要Discovery Service来管理这些地址。 Discovery Service的工作原理 Netflix Eureka 1. Implement a Maven 阅读全文
posted @ 2023-10-21 05:02 小白冲冲 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 拦截器和过滤器之间的区别是什么? 自定义拦截器 1. 创建拦截器类:让类实现HandlerInterceptor接口,重写接口中的三个方法 @Component //定义拦截器类,实现HandlerInterceptor接口 public class ProjectInterceptor imple 阅读全文
posted @ 2023-09-11 23:08 小白冲冲 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 禁止浏览器缓存所有动态页面意味着阻止浏览器在访问网站上的动态生成内容时将这些内容存储在本地缓存中。动态页面通常是那些在每次加载时都会根据用户请求或其他因素而生成不同内容的页面,而不是静态页面,其内容在每次访问时都保持不变。 禁止浏览器缓存动态页面可以确保用户在访问网站时总是看到最新的内容,而不会因为 阅读全文
posted @ 2023-09-11 22:18 小白冲冲 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 创建一个Filter只需要两步 1. 创建一个类,实现Filter接口 public class MyFilter1 implements Filter { // 初始化方法 @Override public void init(FilterConfig filterConfig) throws S 阅读全文
posted @ 2023-08-21 00:25 小白冲冲 阅读(104) 评论(0) 推荐(0) 编辑
摘要: select length('€'), char_length('€') --> 1, 1 LENGTH() returns the length of the string measured in bytes.CHAR_LENGTH() returns the length of the stri 阅读全文
posted @ 2023-08-20 21:56 小白冲冲 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 创建Optional对象 1. 创建一个空的Optional对象 Optional<String> empty = Optional.empty(); 使用 isPresent() 方法检查Optional对象中是否有值。 @Test public void givenNonNull_whenCre 阅读全文
posted @ 2023-08-08 04:52 小白冲冲 阅读(25) 评论(0) 推荐(0) 编辑
摘要: lombok 是什么,它是一个工具类库,可以用简单的注解形式来简化代码,提高开发效率。 要使用lombok需要在pom.xml添加依赖 <dependencies> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombo 阅读全文
posted @ 2022-12-07 05:14 小白冲冲 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 使用Maven创建microserves项目 黄色标记处为需要修改的地方 amigosservices是项目名称 mvn archetype:generate -DgroupId=com.amigoscode.app -DartifactId=amigosservices -DarchetypeAr 阅读全文
posted @ 2022-12-06 23:54 小白冲冲 阅读(24) 评论(0) 推荐(0) 编辑
摘要: public class Main { public static void main(String[] args) { String words = "One Two Three Four"; int countWords = words.split("\\s").length; System.o 阅读全文
posted @ 2022-11-27 23:45 小白冲冲 阅读(21) 评论(0) 推荐(0) 编辑