spring boot external config

后端 未结 5 1120
清歌不尽
清歌不尽 2020-12-30 04:59

I am trying to load an external properties file into my spring boot app. initially I used @PropertySource in the config class. but now I want to remove this annotation so th

5条回答
  •  一整个雨季
    2020-12-30 05:45

    1) Makesure args pass inside of run method

    public class GemFireTestLoaderApplication {
    
    public static void main(String[] args) {
    
            SpringApplication.run(GemFireTestLoaderApplication.class, args);
            }
    }
    

    2) If you have configureed in xml comment or remove first

    
    
    
    

    Following command you can use to pass properties name

    3.1)

    java -jar GemfireTest-0.0.1-SNAPSHOT.jar --spring.config.location=file:///C:/data/xxx/vaquarkhan/dataLoader/test/config.properties
    

    3.2)

    java -jar GemfireTest-0.0.1-SNAPSHOT.jar --spring.config.location=file:///C:/data/xxx/vaquarkhan/dataLoader/test/config.properties
    

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

提交回复
热议问题