java - Spring @PropertySource value not overridding -
in sprint boot application, have configuration class read property files: common.properties
, dev.properties
. have same key server.url
in both property files. value not overridden. per spring documentation, last property file value should taken. it's not working. using spring annoatation @propertysource
read values.
serverconfiguration class
@component @propertysources( { @propertysource(value = "file:common/config/common.properties", ignoreresourcenotfound = true), @propertysource(value = "file:dev/config/dev.properties", ignoreresourcenotfound = true) }) public final class serverconfiguration { private final applicationcontext applicationcontext; /** * server url */ @value("${server.url}") private string serverurl; }
common.properties
server.url=ws://some ip
dev.properties
server.url=ws://localhost:8080
the value common.properties
taken always. tried changing order, still it's not working.
Comments
Post a Comment