I want to import all the messages.properties files, which are contained in the src/main/resource/messages locations of ALL the jar dependencies of my project. for example: Project A import -> Project B, and I need to load all message properties.
I tried:
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasenames("classpath:/messages", "classpath:/messages/messages");
messageSource.setCacheSeconds(3600);
return messageSource;
}
But it did not work =(.How can I do this with spring-boot?
Here's my project structure:
project A
+-- project-server-business
¦ +-- src
¦ ¦ +-- main
¦ ¦ ¦ +-- java
¦ ¦ ¦ +-- resources
¦ ¦ ¦ ¦ +-- messages
¦ ¦ ¦ ¦ ¦ +-- messages-business.properties
¦ +-- pom.xml
+-- project-server-service
¦ +-- src
¦ ¦ +-- main
¦ ¦ ¦ +-- java
¦ ¦ ¦ +-- resources
¦ ¦ ¦ ¦ +-- messages
¦ ¦ ¦ ¦ ¦ +-- messages-business.properties
¦ +-- pom.xml
+-- pom.xml
project B
+-- project-server-business
¦ +-- src
¦ ¦ +-- main
¦ ¦ ¦ +-- java
¦ ¦ ¦ +-- resources
¦ ¦ ¦ ¦ +-- messages
¦ ¦ ¦ ¦ ¦ +-- messages-business.properties
¦ +-- pom.xml
+-- project-server-service
¦ +-- src
¦ ¦ +-- main
¦ ¦ ¦ +-- java
¦ ¦ ¦ +-- resources
¦ ¦ ¦ ¦ +-- messages
¦ ¦ ¦ ¦ ¦ +-- messages-business.properties
¦ +-- pom.xml
+-- pom.xml
My pom build structure:
<build>
<resources>
<resource>
<directory>src${file.separator}main${file.separator}resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<source>${maven.plugin.target}</source>
<target>${maven.plugin.target}</target>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${maven.plugin.target}</source>
<target>${maven.plugin.target}</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>