I have an integration test that needs to get the file path of a properties file in the project and inject it into a bean. The location of the properties file is /src/test/resources/foo.properties in the project and I need someway in the application context to inject it like this:
If anyone can help it would be much appreciated. Thanks.Code:<bean id="config" class="com.foo.rest.data.Config"> <property name="fileLocation" value="file location of internal project resource" /> </bean>
Solved it.
Code:<bean id="classLoader" class="java.security.SecureClassLoader" /> <bean id="config" class="com.foo.rest.data.Config"> <property name="fileLocation" value="#{classLoader.getResource('foo.properties').getPath()}" /> </bean>



Reply With Quote
