Hello,
I have a problem with changing the config file location in spring 5.3.1.
This is how my StandardSpringConfiguration
looks like:
@Configuration
@Retention(RUNTIME)
@PropertySource("classpath:someprops.properties")
@PropertySource(value="file:${config.location:.}/someprops.properties", ignoreResourceNotFound=true)
@ComponentScan(basePackages = "some.package")
public @interface StandardSpringConfiguration { }
Everything worked fine with spring 5.1.6.RELEASE. The issues started when I switched to spring 5.3.1.
In the past I could change the location of the prop like this:
java -jar -Dconfig.location=/somepath/resources someJar.jar --command --option AA
After changing the spring version the -Dconfig.location
is ignored and it will use the default prop file. I tried to get the value of config.location and print it and it prints the correct path introduced in the terminal. Got the value like this:
@Value("${config.location}") String configLocation
Changing a single value from the prop file still works. For exapmle this will work:
java -jar -Ddb_user=SOME_USER someJar.jar --command --option AA
Has anyone encountered such issues with more recent versions of spring?
Comment From: sbrannen
Hi @dinicolae,
In 91a625418792e0e7699785d9fe8d8dbdfc1c89bf, I introduced tests that verify repeatable annotation support for @PropertySource
. These tests pass against master
(i.e., 5.3.3 snapshots). So I have not been able to reproduce the behavior you are describing against the latest and greatest.
Can you please provide a sample application (for example, in a GitHub repository or downloadable zip file) that demonstrates your use case working on 5.1.x
but failing on 5.3.x
?
It would also be great if you could take a look at the tests I introduced to confirm that these new tests cover the use case you have described.
Thanks
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.