spring boot
极客架构
这个作者很懒,什么都没留下…
展开
-
HttpServletResponse乱码问题
HttpServletResponse 乱码原创 2022-12-08 13:51:03 · 723 阅读 · 0 评论 -
Spring Boot @ExceptionHandler 精确匹配优先(按照深度比较)
@ControllerAdvice 中 使用@ExceptionHandler 处理全局异常@Slf4j@Component@ControllerAdvicepublic class GlobalExceptionHandler extends ResponseEntityExceptionHandler { @ResponseBody @ExceptionHandler(value = Throwable.class) public ResponseEntity<Ob原创 2022-01-19 11:15:58 · 1340 阅读 · 0 评论 -
Spring + lombok+ @Qualifier使用
简述虽然lombok 有很多缺点,但确实会减少很多代码。在Spring 中使用lombok 可以让注入更加简单。使用lombok 之前@Service("customer")@Slf4jpublic class CustomerService { @Qualifier("curtaoRestClient") private final RestHighLevelClient restClient; private final ConstructorEsUtil constr原创 2021-01-26 17:55:22 · 1634 阅读 · 1 评论 -
Spring Boot 2.3.6 与 Spring kafka 集成 出错(ClassNotFoundException: org.springframework.kafka.core.Microm
简述spring boot 的出现最主要的原因之一就是解决spring的依赖管理,减少各种依赖包的冲突,让开发者重点关注开发本身,减少环境的配置。在Spring Boot 没有出现之前,SSH框架整合,最开始的问题就是版本冲突,各种版本之间不兼容,让开发者苦不堪言,很长时间才能搭建出完整的一套框架。为了解决该问题,Spring Boot 应运而生,当然Spring Boot 对大部分的第三方依赖都进行了完整的测试。不过最近发现,Spring Boot 升级太快,项目的升级速度已经无法跟上了。为了尽原创 2020-11-27 17:52:24 · 2369 阅读 · 0 评论 -
Springboot 自定义注解及接口多实现注入(策略模式)干掉ifelse
简述Spring Boot 中提供完善的依赖注入机制,极其便利。本文分享接口多实现注入,与自定义注解的结合使用。目标实现,根据自定义注解类型,选择接口实现。本文实例属于典型的策略模式设计,减少复杂if else 方式,更加利于扩展。项目依赖Spring Boot:2.2.6.RELEASE自定义注解@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented@Servicepublic @interfac原创 2020-10-19 15:45:03 · 1456 阅读 · 0 评论 -
Spring Boot 2.2.9 中@Before 不起作用
简述Spring Boot 2.2.9 默认使用的是junit 5,在junit 5中 @Before 被 @BeforeEach代替。调整 @BeforeEach public void setUp() { headers = new HttpHeaders(); headers.set("Content-Type", "application/json"); url = "http://localhost:" + port +原创 2020-08-05 17:54:05 · 1201 阅读 · 0 评论 -
IllegalStateException: Since explicit contact points, the local DC must set spring-data-cassandra
简述Spring data cassandra 3.0.1.RELEASE 建立 连接时出现如下异常Spring Boot版本:2.3.1.RELEASEorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'session' defined in class path resource [com/crm/tool/config/Config.class]: Invocation o原创 2020-07-18 10:22:43 · 1546 阅读 · 0 评论 -
Spring Boot Cassandra JmxReporter 异常
简述使用Spring boot 与>cassandra-driver-core时启动出现异常。Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.datastax.driver.core.Session]: Factory method 'createCluster' threw exception; nested exception is java.lang.NoC原创 2020-07-16 12:25:48 · 454 阅读 · 0 评论 -
SpringBoot测试异常 No qualifying bean of type org.springframework.boot.test.web.client.TestRestTemplate
2020-05-11 17:20:59 [main] ERROR TestContextManager:89 - Caught exception while allowing TestExecutionListener [org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@2fd1433e] to prepare test instance [com.antfa...原创 2020-05-25 18:14:44 · 7712 阅读 · 0 评论 -
Spring Boot 2* 自定义标签验证及异常处理
在本场 Chat 中,会讲到如下内容:自定义验证标签。 普通验证异常的处理。 去掉 BindingResult 统一异常处理。原创 2020-05-06 09:01:07 · 155 阅读 · 0 评论