This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have place the configuration file for spring beans in package,
But when i try to load it with below, the file couldn't identified. It always take the path where the current test class reside (different package from where xml file reside)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [test/com/springsample//main/resources/com/springsample/springsample-introductions.xml]; nested exception is java.io.FileNotFoundException: class path resource [test/com/springsample//main/resources/com/springsample/springsample-introductions.xml] cannot be opened because it does not exist
But when i try without annotation like below, it recognized the file successfully,
ApplicationContext context =
Best practice says test cases should have their own configuration. This way you can define only the beans needed by the test case and you keep production configuration separate from test configuration. You should put these in src/test/resources not src/main/resources/
I assume this is for a test case as that is what @ContextConfiguration is used for.
That said my next suggesting is stop using \ and start using / that way you don't have to escape them.