Spring Run Configuration cannot resolve placeholders

Answered

Hello, I am having some difficulty setting up a run configuration. It is a Gradle project that uses spring and I am having difficulties getting IntelliJ to use the correct properties files. The file structure for the files are shown as below (etc is a subdirectory of the project directory). The etc folder is set as a resource directory in the module settings.

Currently, when running the build it would complain that it cannot resolve a placeholder (despite being defined in common.properties or app.properties). I have the applicationContext set using a VM Option -DspringConfigFile=/common/common/app1/applicationContext.xml.

When running, IntelliJ should have picked up app1.properties which would import common.properties. I believe that it is unable to resolve which common.properties do use.

Does anyone have an idea on how to resolve this? I am not able to change the file structure as there are other developers that use Eclipse for this project.

0
6 comments

Do you experience this issue only in IntelliJ IDEA? Does the correct profile get picked up if you start it with the same command line option outside of the IDE using Gradle?

0
Avatar
Permanently deleted user

I only have this issue with IntelliJ IDEA specifically Ultimate version. When my pc migrated to a VDI, i no longer have the community version and now have the Ultimate instead. In community, I would be able to create multiple modules for each application pointing to different applicationContext and properties file (app1 module, app2 module). However, it seems that I am unable to do that now as gradle will use reset all my modules. 

I have never tried running the application using gradle cli. What command would I run?

0
Avatar
Permanently deleted user

The bootRun is something for applications using Spring Boot, my application is not using Spring Boot, we're using just the Spring Framework.

0
Avatar
Permanently deleted user

Hey, thx for helping out. I played around with build for a while, it turns out if I scrolled the console output towards the top, it would say it cannot locate the 'app.properties' file. I resolved that and now it's working.

0

Please sign in to leave a comment.