How to use application.yml file from my sub modules?

Viewed 602

Hi I am working on a spring boot application which contains multiple apps and multiple modules. Folder structure is like this

project
       - apps
         - app1
         - app2
       - modules
         - module1
         - module2

each modules have their own resource application-module{number}.yml file.

Now I am using these module1 and module2 in my app1 which is a spring boot application.

app1 have application.yml file which contains this

spring:
    profiles:
      include: >
          module1,
          module2

I also added EnableConfigurationProperties({Module1Config.class, Module2Config.class}) after @SpringBootApplication in my application file of app1. Still configuration are not getting picked up.

If I am putting those modules config in app1 llike

app1
   - resources
        - application.yml
        - application-module1.yml
        - application-module2.yml

then it is working. But I want to use those from my modules only.. How can I do that???

1 Answers

Oh I did it somehow...

I added one application.yml file in module1 resource folder with content

spring:
    profiles:
       include: >
          module1

similarly in module2

spring:
     profiles:
         include: >
            module2

It's working now... thanks to me... :)

Related