springboot使用spring.profiles.active搭配@Profile注解失效问题

好久没写博客了,出来冒个泡。

我搭建了一个springboot的测试环境,想着用spring的profiles属性区分开生产bean和开发bean。
application.properties的配置如下:
springboot使用spring.profiles.active搭配@Profile注解失效问题_第1张图片
2个java类如下:
第一个:
springboot使用spring.profiles.active搭配@Profile注解失效问题_第2张图片
第二个:
springboot使用spring.profiles.active搭配@Profile注解失效问题_第3张图片
启动项目,莫名的就报错了,报错如下:
说是找不到相应的bean,也就是bean创建失败

springboot使用spring.profiles.active搭配@Profile注解失效问题_第4张图片
百思不得其解,后来感觉上面那个分号好像是有点别扭。就去了,再试就成功了

你可能感兴趣的:(SpringBoot,@Profile)