In fact the "AbstractDependencyInjectionSpringContextTests " class does correctly cache the applicationcontext. The problem is that even though the applicationcontext is cached, my Hibernate session factory does get rebuild.
In fact the "AbstractDependencyInjectionSpringContextTests " class does correctly cache the applicationcontext. The problem is that even though the applicationcontext is cached, my Hibernate session factory does get rebuild.
ok. I figured out a bug in the way I implemented the test class. Now I dig into Maven and see what's going on there.
Hi there.
First I'd like to thank feester for the class. Great job.
Now, the problem I am having. I am able to pass the xml files and the loading starts with no problem.
During the initialization of a bean with property defined as follows
I get a nested exception java.io.FileNotFoundException: Could not open class path resource [WEB-INF/my.properties].Code:<property name="location"> <value>/WEB-INF/my.properties</value> </property>
If I remove the /WEB-INF/ from the value field everything works perfectly.
Or, without removing that, I can add my root to the classpath, but I do not want to do that.
I have tried to add such resource dynamically to the class path but I could not figure out a way to add it to the context.
Any help will be appreciated thanks.
Well, I think I solved my problem.
In case anybody is interested, the only modification I had to make was to change the ClassPathXmlApplicationContext to FileSystemXmlApplicationContext. In other words:
Now the context is built from the file system using the app working directory as the base dir. So now my initilize() method looks like:Code:context = new FileSystemXmlApplicationContext ( xmlFiles );
Hope it helps.Code:initialize("/WEB-INF/classes/file1.xml,/WEB-INF/classes/file2.xml);