Reputation: 3415
I'm porting a Spring application to Spring Boot. I'd like to be able to configure Spring Security using xml so I can use my old config files. (I've tried using Java config and it doesn't work).
How do I get Spring Boot to pick up the xml configuration? Spring does not see to have any documentation on this.
Upvotes: 0
Views: 9901
Reputation: 16555
Why do you want to import your old xml file ? The best thing about spring-boot is that you don't need to use your old file and you can rewrite it in java
Upvotes: 0
Reputation: 16589
You have to use @ImportResource
.
@SpringBootApplication
@ImportResource("classpath:<name>.xml")
public class Config {
public static void main(String[] args) {
SpringApplication.run(Config.class, args);
}
}
Refer to these links for proper understanding :
Upvotes: 3
Reputation: 8682
You can import xml configuration using org.springframework.context.annotation.ImportResource
annotation. in one of the configuration class which is annotated with @Configuration
do the following.
If your security config is named security-config.xml
at the root of the classpath then add the like below.
@ImportResource({"classpath:security-config.xml"})
Upvotes: 2