Reputation: 5878
I have a huge xml that I want to import at it is now on my spring app.
Checking the docs, http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/Configuration.html I found I can do something like this
@PropertySource("classpath:/resources/applicationContex.xml")
My resources folder is under /src/main
But I get a file no exists error, any idea if this is the correct way to do it? or is my path wrongly defined?
Upvotes: 2
Views: 879
Reputation: 34470
As @Sotirios says in his comment, you should remove the /resources
prefix. But you're also using the wrong annotation: @PropertySource
is used to import property files. You should use the @ImportResource
annotation.
@Configuration
@ImportResource("classpath:applicationContext.xml")
public class AppConfig {
// define more beans, wire beans defined in the xml, etc
}
Note: You might also have a typo: you were pointing to a file named applicationContex.xml
. Shouldn't it be applicationContext.xml
instead? (Note the final t
before the .xml
extension).
Upvotes: 3