Issue
I have a spring boot 1.5.1 project that uses profile properties file. In my /src/main/resources I have all my properties files src="https://i.stack.imgur.com/2wCY8.png" alt="enter image description here">
When using IntelliJ 2016.3.4 I set the
Run Configuration | Active Profile
to "local" and run it. I see this in the console:
The following profiles are active: local
But there is a value in the property file
data.count.users=2
and used as:
@Value("${data.count.users}")
private int userCount;
that is not being picked up and thus causing the error:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'data.count.users' in string value "${data.count.users}"
However, if I run this via gradle
bootRun {
systemProperty 'spring.profiles.active', System.properties['spring.profiles.active'] }
as
gradle bootRun -Dspring.profiles.active=local
then everything starts up using the local profile as expected. Can anyone see why this is not being properly picked up? In IntelliJ Project Structure I have my /src/main/resources defined as my Resource Folders.
UPDATE:
Adding screenshot of Configuration:
Solution
- Pease add Spring facet to your Spring Boot module to get full support
- Is classpath of module
heimdall
the correct one, i.e. does it contain the shownresources
folder with yourapplication.properties
? - If this doesn't help, please file a minimum sample project reproducing the exact structure of your project in our bugtracker, there are too many variables to investigate https://youtrack.jetbrains.com/issues/IDEA.
Answered By - Yann Cébron
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)