2

I am using Intellj to run my Spring Boot application which has application.yml file with place holder. The values of placeholder should be injected at run time depending upon the environment configuration.

server: port: ${SERVER_PORT} 

I am trying to run the Spring Boot application from Intellij by passing the place holder value in the Environment Variable section of application run

I am getting below error while running this application:

Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'SERVER_PORT' in value "${SERVER_PORT}" Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'SERVER_PORT' in value "${SERVER_PORT}"

1 Answer 1

2

Could be this is because your variable assignment is recursive, in a way. SERVER_PORT is the same property as server.port or

server: port: 

See here for a list of sources for configuration properties and their order of precedence.

Try removing the section from your yaml file. If you declare an environment variable server.port or SERVER_PORT then SpringBoot will pick it up and use it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.