Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Properties not found with Spring PropertySource

Config

@Configuration
@PropertySources({
    @PropertySource("classpath*:properties/test-database.properties")
})
public class DataSourceConfiguration {//...
}

Prop location

D:\Projects\opti\dao\src\main\resources\properties\test-database.properties

D:\Projects\opti\dao\src\main\resources marked as resource folder.

like image 952
Arthur Avatar asked Oct 26 '25 16:10

Arthur


1 Answers

To avoid this kind of problem the issue is to set the jboss.server.config.dir in VM arguments like that :

-Djboss.server.config.dir="[jboss_repository]/server/[default-all-standard-standalone]/conf" –server

and u set PropertySource like this :

@Configuration
@PropertySource("file:${jboss.server.config.dir}/file.properties")

Or you set ur property like that

@PropertySource(value = "classpath:application.properties")

When executed, properties will be imported from the application.properties
file, located in the classpath root.

like image 194
Ibrahim BEN ABDERRAHMANE Avatar answered Oct 29 '25 05:10

Ibrahim BEN ABDERRAHMANE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!