SpringBoot 2.x 终极解决跨域问题方案 CORSConfig import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import o 编程 2021年03月28日 0 点赞 0 评论 818 浏览
springboot2 logback-spring.xml 日志配置 需要在 src/java/resources 中增加 logback-spring.xml 注意,logback 配置文件,必需是 logback-spring 这个名称 编程 2021年06月14日 0 点赞 0 评论 802 浏览
SpringBoot使用@Async时,如下方式会失效 SpringBoot使用@Async时,如下方式会失效:1. 异步方法使用static关键字时,会失效2. 异步类实例必需由Spring管理,如果没有使用@Component等注解,无法扫描到,当然也就不生效3. 异步方法不能与异步方法在同一个类中4. 类中需要使用@Autowired或@Resource等注解自动注入,不能自己手动new对象5. 如果使用SpringBoot框架必须在启动类中增加 编程 2021年08月18日 0 点赞 0 评论 535 浏览
SpringBoot2 直接获取 Request对象 SpringBoot2 直接获取 Request对象 HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); 编程 2021年10月09日 0 点赞 0 评论 773 浏览
C1.SpringBoot 2.5 整合 Sentinel 1.8 添加接口限流功能 添加 Maven <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> <version>2 编程 2021年11月19日 0 点赞 0 评论 537 浏览