这是我的Application.java的示例要点
@Configuration@EnableautoConfiguration@ComponentScan(basePackages = "org.com.app.clIEnt.controller")@EnableJpaRepositorIEs(basePackages = "org.com.app")@EntityScan(basePackages = "org.com.app.model")public class Application extends SpringBootServletinitializer { public static voID main(String[] args) { ApplicationContext ctx = SpringApplication.run(Application.class,args); } @OverrIDe protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } /** * Spring Web MVC Confugrations * **/ @Bean public ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver(){ ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver = new ExceptionHandlerExceptionResolver(); return exceptionHandlerExceptionResolver; } @Bean public VIEwResolver internalResourceVIEwResolver(){ InternalResourceVIEwResolver vIEwResolver = new InternalResourceVIEwResolver(); vIEwResolver.setPrefix("/WEB-INF/Jsp/"); vIEwResolver.setSuffix(".Jsp"); return vIEwResolver; }
但是当我尝试运行我的mvn spring-boot时:运行此异常总是会发生.我错过了什么?
12:30:22.670 [org.brightworks.genesis.clIEnt.Application.main()] WARN o.s.b.c.e.AnnotationConfigEmbeddeDWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vIEwControllerHandlerMapPing' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcautoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method Failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapPing]: Factory method 'vIEwControllerHandlerMapPing' threw exception; nested exception is java.lang.IllegalStateException: The resources may not be accessed if they are not currently started at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractautowireCapablebeanfactory.instantiateUsingFactoryMethod(AbstractautowireCapablebeanfactory.java:1119) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractautowireCapablebeanfactory.createBeanInstance(AbstractautowireCapablebeanfactory.java:1014) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractautowireCapablebeanfactory.doCreateBean(AbstractautowireCapablebeanfactory.java:504) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractautowireCapablebeanfactory.createBean(AbstractautowireCapablebeanfactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.Abstractbeanfactory.getobject(Abstractbeanfactory.java:303) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:299) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:194) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.Defaultlistablebeanfactory.preInstantiateSingletons(Defaultlistablebeanfactory.java:755) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishbeanfactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.boot.context.embedded.EmbeddeDWebApplicationContext.refresh(EmbeddeDWebApplicationContext.java:118) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:946) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE] at org.brightworks.genesis.clIEnt.Application.main(Application.java:38) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_67] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_67] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_67] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_67] at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418) [spring-boot-maven-plugin-1.2.3.RELEASE.jar:1.2.3.RELEASE] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapPing]: Factory method 'vIEwControllerHandlerMapPing' threw exception; nested exception is java.lang.IllegalStateException: The resources may not be accessed if they are not currently started at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] ... 23 common frames omitted Caused by: java.lang.IllegalStateException: The resources may not be accessed if they are not currently started at org.apache.catalina.webresources.StandardRoot.valIDate(StandardRoot.java:232) ~[tomcat-embed-core-8.0.3.jar:8.0.3] at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:199) ~[tomcat-embed-core-8.0.3.jar:8.0.3] at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:193) ~[tomcat-embed-core-8.0.3.jar:8.0.3] at org.apache.catalina.core.ApplicationContext.getResource(ApplicationContext.java:533) ~[tomcat-embed-core-8.0.3.jar:8.0.3] at org.apache.catalina.core.ApplicationContextFacade.getResource(ApplicationContextFacade.java:198) ~[tomcat-embed-core-8.0.3.jar:8.0.3] at org.springframework.web.context.support.ServletContextResource.exists(ServletContextResource.java:102) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.boot.autoconfigure.web.WebMvcautoConfiguration$WebMvcautoConfigurationAdapter.addStaticIndexhtmlVIEwControllers(WebMvcautoConfiguration.java:275) ~[spring-boot-autoconfigure-1.2.3.RELEASE.jar:1.2.3.RELEASE] at org.springframework.boot.autoconfigure.web.WebMvcautoConfiguration$WebMvcautoConfigurationAdapter.addVIEwControllers(WebMvcautoConfiguration.java:270) ~[spring-boot-autoconfigure-1.2.3.RELEASE.jar:1.2.3.RELEASE] at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.addVIEwControllers(WebMvcConfigurerComposite.java:119) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.addVIEwControllers(DelegatingWebMvcConfiguration.java:77) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.vIEwControllerHandlerMapPing(WebMvcConfigurationSupport.java:346) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.boot.autoconfigure.web.WebMvcautoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringcglib$267062.cglib$vIEwControllerHandlerMapPing(
最佳答案我找到了解决方案.我使用的是不正确的servlet版本.我在Servlet版本3.0.1上,我已经覆盖了d簧启动的默认Servlet版本,因此错误. 总结 以上是内存溢出为你收集整理的java – Spring Boot viewControllerHandlerMapping配置全部内容,希望文章能够帮你解决java – Spring Boot viewControllerHandlerMapping配置所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)