I am deploying Spring 3 app on Tomcat7. I am using OXM unmarshaller so I need to create StreamSource like this:
unmarshaller.unmarshal(new StreamSource(new FileInputStream(dbSetupPath)))
I set value for dbSetupPath like this and it works in unit tests:
@Value("src/main/resources/db-setup.xml")
String dbSetupPath;
When I deploy on Tomcat though, I am getting FileNotFoundException. What is correct path that’ll keep my tests passing and Tomcat working? I am deploying exploded:war atm.
So my solution was to inject the value to the org.springframework.core.io.Resource instead of the plain String like this:
And then I accessed the underlying file and supplied it to the marshaller: