I've generated Spring Boot application with annotation driven configuration.
However I wanted to configure some of the Spring Security with xml configuration because I have already a XML file that does it.
So I've created web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
</web-app>
and added @ImportResource("classpath:web.xml") to my @SpringBootApplication class
@SpringBootApplication
@ImportResource("classpath:web.xml")
public class Application extends WebMvcConfigurerAdapter {
public static void main(String[] args) {
SpringApplication.run(new Class[] { Application.class, WebAppInitializer.class }, args);
}
}
And then I get:
2016-10-23 13:01:52.888 ERROR 9120 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://java.sun.com/xml/ns/javaee] Offending resource: class path resource [web.xml]
What is wrong?