Reputation: 1
In my Spring MVC application application we are maintaining many configuration files like .properties
and .txt
files. I want to read all configuration files and keep them in application context level, so that I can access configuration data in my entire application.
Example:
db.properties
db.driveClassName=packages.DataSource
db.URL=some url....
errorCodes.properties
<error-code>=<error description>
ERR001=time out error occured
ERR002=The request was tampered
ERR003=transaction id is missing
Upvotes: 0
Views: 161
Reputation: 383
Best way is to use @ConfigurationalProperties then they are type safe and you can even validate them look at this guide http://www.baeldung.com/configuration-properties-in-spring-boot
Upvotes: 1