Purna Reddy
Purna Reddy

Reputation: 1

best way to maintain properties files in spring mvc application

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:

  1. db.properties

    db.driveClassName=packages.DataSource
    db.URL=some url....
    
  2. 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

Answers (1)

Sławomir Czaja
Sławomir Czaja

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

Related Questions