Mahozad
Mahozad

Reputation: 24532

How to move messages.properties files into a separate folder?

Is it possible to place messages.properties and all other locale-specific messages_xx.properties files in a sub-folder of the resources folder in a Spring Boot application? For example to move them all in langs folder:

ā”€ā”€ā”€ šŸ— src
   ā””ā”€ā”€ā”€ šŸ— main
       ā”œā”€ā”€ā”€ šŸ— java
       ā””ā”€ā”€ā”€ šŸ— resources
           ā”œā”€ā”€ā”€ šŸ— langs
           ā”‚   ā”œā”€ā”€ā”€ messages.properties
           ā”‚   ā””ā”€ā”€ā”€ messages_fa.properties
           ā””ā”€ā”€ā”€ ...

Upvotes: 0

Views: 989

Answers (1)

Mahozad
Mahozad

Reputation: 24532

Yes, it is possible. You just need to add this property in the application.properties or application.yml file:

spring.messages.basename=langs.messages

Here langs is the name of the folder and messages is the base name of files.

Upvotes: 2

Related Questions