I would like override SpringBoot
external's some config into classpath file., when I run jar by command line.
classpath -> application-config.yaml (Not application.yaml)
server:
port: 8080
servlet:
contextPath: /myapp
test-message: this config no need to export as external config.
external -> D:/test/application-config-override.yaml
server:
port: 9090
command
java -Dspring.config.location=classpath:application-config.yaml,file:///D:/test/application-config-override.yaml -jar myapp.jar
when I run above commend, the application is running 8080, contextPath is "myapp". My expected one is http://localhost:9090/myapp
But, if I put all of same config structure of application-config.yaml
into application-config-override.yaml
as below
application-config-override.yaml
server:
port: 9090
servlet:
contextPath: /yourapp
test-message: this config no need to export as external
Application is running 9090, contextPath is "yourapp".
How to override SpringBoot external some config into classpath file? I am using 2.5.4.
I don't want to export unnecessary some configs to external. I would like to marge and override by order.
Try to provide both spring.config.additional-location
and spring.config.name
like this,
-Dspring.config.additional-location=D:///test/ -Dspring.config.name=application-config,application-config-override