How to externalize application.properties in Tomcat webserver for Spring?

后端 未结 8 2216
终归单人心
终归单人心 2020-12-10 01:59

SpringApplication will load properties from application.properties files in the following locations and add them to the Spring Environment:



        
8条回答
  •  执笔经年
    2020-12-10 02:28

    for tomcat 9 on Ubuntu 18.04 and spring boot 2, create setenv.sh file under $CATALINA_HOME/bin/ working for me:

    #!/bin/bash
    
    export spring_config_additional_location="/opt/tomcat/latest/conf/application.properties"
    

    don't forget to set file permission if needed

提交回复
热议问题