Search code examples
javaspring-bootspring-annotations

@value annotation returns me a wrong value


When accessing a property with value 7777 @value annotation returns me 20080

code used:

  • Property in .properties file proxy.port=7777
  • Variable in java class as
    @Value(value = "${proxy.port:0}")
    private Integer proxyPort;

is it changing the number base or something ?

Additional information: On eclipse the value is 7777 , when I deploy this on a server the value changes . On server I run it in a jar .


Solution

  • I think the issue here is that on server there might be an environment variable that could have different value. Spring treats those at highest preference over values defined in property. Check on your server, if there is a environment variable defined with the same name.