Spring Context for standalone application in Selena EAP

Hi all, I just started trying the Selena EAP and was wondering if a case like mine can be dealt with.

I have an application built on Spring: what is particular in this application is the fact that it's a standalone app, loading the Spring context through a FileSystemXmlApplicationContext.

What seems to create my problem is the fact I use a particular directory layout for the module. In the root dir for the module I have both:
/src - for source code which will be compiled
/root - as a root for the final app (sort of an "exploded dir" for my application).

The application context file is in /root/cfg, but when the app is executed, /root is meant to be the working directory: since I use a PropertyPlaceholderConfigurer in order to load properties from a property file that is in the same dir as the applicationContext.xml, in this same file I refer to it as

The problem is that although IDEA allows me to set a working directory when executing or debugging the application, this piece of information does not seem to be taken into account in the application context xml validation, and all the property references are marked red because the property file is not recognized.

Is there any way to deal with a situation like this one?


Hi David,

you may try to refer your files as "/cfg/application.properties"...


You should have your "root" directory marked as source root in this case.


This works, thanks. I assumed that the preceding "/" would make this an absolute reference but apparently this does not work like that in Spring.


In addition to comments by Dmitry, I think it's often convenient to use ClassPathXmlApplicationContext
and "classpath:/some/path/config.properties" resources in standalone applications.


+1. This, in fact, is a preferred way for stand-alone apps, test harnesses, and inside-jar configurations.


Please sign in to leave a comment.