***************************
APPLICATION FAILED TO START
***************************
Field securityProperties in xxx required a bean of type 'com.xxx.xx.core.xxx.XXXProperties' that could not be found.
Action:
Consider defining a bean of type 'com.xxx..XXXProperties' in your configuration.
自己做一個springcloud的時候遇到了
@ConfigurationProperties不生效,然后報錯如上
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
百度說需要加這段,實際pom里面已存在這個,找了我半夜也沒找到為什么另一個工程行,這個就不行
早上沒有目的的百度找了找幾個答案,靈光乍現
from:https://blog.csdn.net/qq_30725371/article/details/80356156
我仔細想想,應該是我啟動類移動了地方導致的,因為我引用的propertie 是在base目錄下,全路徑為com.x.base.XXXProperties,
我的啟動類原先在com.x包下,被我移至com.x.zzz下(com.x.zzz.XXXApplication),啟動就是報錯,很郁悶
后來移回至com.x包下,竟然可行了,看來 ComponentScan 如果默認則掃描范圍是當前包路徑向下的所有路徑