I have 2 Spring Boot apps. AppA is a jar that primarily acts as a service (services, external api calls, etc). AppB is a war that has AppA as a dependency.
AppA (jar) currently does not have a MySvcApplication.java
file @SpringBootApplication
because it is never ran on it's own and I noticed that when running AppB, that file is never ran. AppB (war) has a MyMainApplication.java
file with @SpringBootApplication
with scanBasePackages
property.
I would like AppA and AppB to have their own properties files, and if possible, a shared properties file (inside the svc) (i.e. svc.properties, main-app.properties, common.properties).
I have read on a few ways (in-app, command-line) to change the file name (via spring.config.name) but that applies for the war (in MyMainApplication.java
), but not the dependency jar.
SpringApplicationBuilder()
.properties("spring.config.name=myproject")
.sources(MyApplication.class)
.run(args);
Any ideas?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…