我開始從Eclipse中我的春節,啓動應用程序與此VM參數ConverterNotFoundException:-Dserver.port = 80 noverify沒有找到兌換...字符串到整數
-Dserver.port=80
應用.yml
server:
port: 8080
,但我得到下面的異常「沒有找到轉換器能夠從[java.lang.String]類型轉換爲類型[java.lang.Integer]「。
Running with Spring Boot v1.5.4.RELEASE, Spring v4.3.9.RELEASE
...
2017-07-19 11:26:55.299 ERROR 5968 --- [ main] o.s.b.b.PropertiesConfigurationFactory : Properties configuration failed validation
2017-07-19 11:26:55.299 ERROR 5968 --- [ main] o.s.b.b.PropertiesConfigurationFactory : Field error in object 'server' on field 'port': rejected value [80-noverify]; codes [typeMismatch.server.port,typeMismatch.port,typeMismatch.java.lang.Integer,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [server.port,port]; arguments []; default message [port]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer' for property 'port'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.lang.Integer]]
Field error in object 'server' on field 'port': rejected value [80-noverify]; codes [typeMismatch.server.port,typeMismatch.port,typeMismatch.java.lang.Integer,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [server.port,port]; arguments []; default message [port]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer' for property 'port'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.lang.Integer]]
...
***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [email protected]daea failed:
Property: server.port
Value: 80-noverify
Reason: Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer' for property 'port'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.lang.Integer]
Action:
Update your application's configuration
如果我使用屬性server.port
我application.yml
它的作品,沒有任何問題。
我在做什麼錯?謝謝你的幫助。
我們可以看看你的'application.yml'我懷疑你的端口字符串是這裏的問題 –
你也可以顯示'pom.xml'嗎?看起來你只是缺少一個轉換器,你是否排除了Spring Boot帶來的任何依賴? – cahen
http://stackoverflow.com/questions/37102273/environment-variables-and-value-cant-work-together-on-spring-boot –