Skip to main content
added 650 characters in body
Source Link
peekay
  • 1.3k
  • 2
  • 26
  • 52

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 the class is not dependent on the location. so I tried to use:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/ 

based on this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation but I get the following error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 

using the annotation works fine but I would really like to move away from that. any help on this would be great

Thanks

****** CORRECTION *******

Sorry copy paste error the above command was supposed to be:

java -jar my-boot-ws.war --spring.config.location=file:///Users/TMP/resources/ 

I'm not trying to change the name of the config file just add an additional location. As explained here:

If spring.config.location contains directories (as opposed to files) they should end in / (and will be appended with the names generated from spring.config.name before being loaded).

I interpreted this as saying that the file ${spring.application.name}.properties would be loaded from the --spring.config.location passed in from the command line

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 the class is not dependent on the location. so I tried to use:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/ 

based on this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation but I get the following error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 

using the annotation works fine but I would really like to move away from that. any help on this would be great

Thanks

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 the class is not dependent on the location. so I tried to use:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/ 

based on this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation but I get the following error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 

using the annotation works fine but I would really like to move away from that. any help on this would be great

Thanks

****** CORRECTION *******

Sorry copy paste error the above command was supposed to be:

java -jar my-boot-ws.war --spring.config.location=file:///Users/TMP/resources/ 

I'm not trying to change the name of the config file just add an additional location. As explained here:

If spring.config.location contains directories (as opposed to files) they should end in / (and will be appended with the names generated from spring.config.name before being loaded).

I interpreted this as saying that the file ${spring.application.name}.properties would be loaded from the --spring.config.location passed in from the command line

added 2 characters in body
Source Link
peekay
  • 1.3k
  • 2
  • 26
  • 52

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 the class is not dependent on the location. so I tried to use:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/ 

based on this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation but I get the following error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 

using the annotation works fine but I would really like to move away from that. any help on this would be great Thanks

Thanks

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 the class is not dependent on the location. so I tried to use:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/ 

based on this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation but I get the following error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 

using the annotation works fine but I would really like to move away from that. any help on this would be great Thanks

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 the class is not dependent on the location. so I tried to use:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/ 

based on this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation but I get the following error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 

using the annotation works fine but I would really like to move away from that. any help on this would be great

Thanks

Source Link
peekay
  • 1.3k
  • 2
  • 26
  • 52

spring boot external config

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 the class is not dependent on the location. so I tried to use:

java -jar my-boot-ws.war --SPRING_CONFIG_NAME=file:///Users/TMP/resources/ 

based on this http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation but I get the following error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 

using the annotation works fine but I would really like to move away from that. any help on this would be great Thanks