當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
Spring boot Failed to bind properties under ‘XXX‘问题
生活随笔
收集整理的這篇文章主要介紹了
Spring boot Failed to bind properties under ‘XXX‘问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
啟動Spring Boot 出錯:Failed to bind properties under ‘emp’ to com.njust.platform_server.service.Emp
Description:Failed to bind properties under 'emp' to com.njust.platform_server.service.Emp$$EnhancerBySpringCGLIB$$6ee3bc26:Reason: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'emp' to com.njust.platform_server.service.Emp$$EnhancerBySpringCGLIB$$6ee3bc26Action:Update your application's configuration新手很常見的問題,有各種原因,我這里是因為在實體類里寫了方法,導致不匹配
@Configuration @ConfigurationProperties(prefix = "emp") //@PropertySource(value = "classpath:hadoop.yml") @Data public class Emp {private int port;private String type;public void getParameters(){System.out.println(port);System.out.println(type);} }刪掉就好了,這個類里不允許有任何其它方法
@Configuration @ConfigurationProperties(prefix = "emp") //@PropertySource(value = "classpath:hadoop.yml") @Data public class Emp {private int port;private String type;}太蠢了。。。
總結
以上是生活随笔為你收集整理的Spring boot Failed to bind properties under ‘XXX‘问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 无极性电容的定义及应用
- 下一篇: 当你部署tomcat遇到HTTP Sta