0

I have two spring application let say application_a and application_b, My application_b is dependent on application_a. I created jar of first application using mvn package and added its jar to my local maven .m2/repository, and added its dependancy in application_b e.g

<dependancy>
 <groupId> com.application.a </groupId>
 <artifactId> sample </artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <classifier>app-to-import</classifier>
</dependancy>

Problem is that, In my application_a I am reading some properties from its own application.properties file, Alone application_a is working fine but when I am running application_b then application_a is looking for properties in application_b's properties file, I want application_a to be read properties from its own application.properties even when it is used inside some other spring application. In simple word application.properties is being override how can I stop that. Thanks.

Afsar edrisy
  • 1,985
  • 12
  • 28

1 Answers1

0

Can you share the project structure for both the apps? Since properties are configured as to how you have defined them to be taken up from, nonetheless, Spring supports externalized configuration:

https://docs.spring.io/spring-boot/docs/1.5.22.RELEASE/reference/html/boot-features-external-config.html

This means you can create new profiles for each app, for e.g. application-a.properties and application-b.properties with using appropriate spring.profiles.active property to distinguish between the two.

Karan Mehta
  • 53
  • 1
  • 15