External configuration for spring-boot application

后端 未结 4 1562
余生分开走
余生分开走 2020-12-02 11:13

I have a spring-boot application which I want to run with external configuration file. When I run it as jar (with embedded servlet container), everything is fine. But I want

4条回答
  •  眼角桃花
    2020-12-02 12:02

    Spring Boot offer many ways to specify the location of your properties, it´s not needed to modify your sources.

    Yo can define the spring.config.location value for example:

    • In your tomcat/conf/Catalina/ context descriptors:

      
          
      
      
    • As a JVM parameter in your tomcat setenv.sh file:

      -Dspring.config.location=/path/to/application.properties
      
    • As a SPRING_CONFIG_LOCATION environment variable.

提交回复
热议问题