3

I build my spring boot application to .jar file with:

./gradlew build 

and when I want to run this app:

java -jar /build/libs/app.jar 

I get error:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.data.mongodb.host' in string value "${spring.data.mongodb.host}" 

etc.

When I run this app in IntelliJ everything is ok.

My application.properties

spring.data.mongodb.host=localhost spring.data.mongodb.port=27017 spring.data.mongodb.username=newsAdminUser spring.data.mongodb.password=abc123 spring.data.mongodb.database=newssystemservice server.compression.enabled=true server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain 

What's the problem?

5
  • how are you reading the properties? from property file? Commented Mar 28, 2016 at 19:38
  • yes application.properties Commented Mar 28, 2016 at 19:39
  • Add more details, especially the application.properties, to question Commented Mar 28, 2016 at 19:39
  • 3
    Check if your jar file contains the property file, if not then you have to bundle the property file in jar. see stackoverflow.com/questions/24724383/… for more info. Commented Mar 28, 2016 at 19:42
  • Yes, it's works. Thanks Commented Mar 28, 2016 at 20:13

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.