@Configuration配置类里面使用@Value获取不到.yml配置文件属性的值

阅读 74

2022-08-09


解决这个错误找了好长时间,终于ok了
通常这个错是在shiroConfig中
原因:LifecycleBeanPostProcessorBean 总是先于spring 读取yml文件。导致配置失败
解决方法:加一个static

@Bean
public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}

修改之后:

@Bean
public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}


精彩评论(0)

0 0 举报