#org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'resourceHandlerMapping' threw exception; nested exception is java.lang.IllegalStateException: No ServletContext set
原本想练手一下SSM架构,结果莫名其妙的报了个错误,说什么非法创建,没有Servlet容器设置,反复看来看去,想着是不是SpringConfig类扫描的组件里jdbcConfig和MybatisConfig第三方对象类没有适当引入,@ComponentScan扫描该包重复,就在本包内(含@Configuration的其他类)直接用了@Import(JdbcConfig.class..等等)特定引入,然后@ComponentScan(不扫描被引入的)精准扫描,结果就能创建
或使用@Service里的接口代理了