springboot 用了@ImportResource 配置的拦截器就不起作用了
去掉@ImportResource注解 拦截器就好了
代码:
package com.example.springbootdemo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @SpringBootApplication @ImportResource(locations={ "classpath:config/spring-mongo.xml"}) public class SpringbootdemoApplication extends SpringBootServletInitializer { /** * 让spring boot在tomcat中运行 * @param builder <