随笔分类 -  spring相关

SprintBoot日志
摘要:yml配置 使用 阅读全文
posted @ 2019-11-08 13:49 liehen2046 阅读(152) 评论(0) 推荐(0)
springboot非web项目
摘要:使用CommandRunner 阅读全文
posted @ 2019-10-29 23:34 liehen2046 阅读(378) 评论(0) 推荐(0)
@Autowired使用说明
摘要:注入顺序 @Autowired先以类型进行注入,再以名称进行注入,而@Resource以名称进行注入,不太推荐。 指定名称 @Autowired遇到多个同继承类时可能会出问题,建议带个@Qualifier指定下名称。 使用方式 建议不要用在字段上,可能因未初始化而报空指针,建议用在setter或构造 阅读全文
posted @ 2019-06-20 14:03 liehen2046 阅读(392) 评论(0) 推荐(0)
SpringBoot深入了解
摘要:核心配置文件 application 配置文件,主要用于 Spring Boot 项目的自动化配置。 bootstrap 配置文件有以下几个应用场景。 使用 Spring Cloud Config 配置中心时,这时需要在 bootstrap 配置文件中添加连接到配置中心的配置属性来加载外部配置中心的 阅读全文
posted @ 2019-06-19 22:41 liehen2046 阅读(576) 评论(0) 推荐(0)
@Autowired注解和静态属性
摘要:@Autowired注解入static属性时,出现NullPointerException异常。 使用构造方法可解决: 使用@PostConstruct注解解决: 阅读全文
posted @ 2019-04-23 17:56 liehen2046 阅读(1136) 评论(0) 推荐(0)