zoukankan      html  css  js  c++  java
  • Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

    照着教程弄的第一个 DEMO,结果启不来。

    解决办法:在Controller 上面加上 @EnableAutoConfiguration 

    成功启动


    Demo的其它内容及配置如下图,新建一个 空的 Maven 项目

    Pom.xml

     主界面:

    Control.java

    运行报错

     :: Spring Boot ::        (v2.2.5.RELEASE)
    
    2020-03-06 08:41:45.942  INFO 8240 --- [           main] com.iron.HelloWorldMainApp               : Starting HelloWorldMainApp on ChenJun with PID 8240 (F:ProjectSpringBootsprintboot01helloworld	argetclasses started by Jimmy in F:ProjectSpringBootsprintboot01helloworld)
    2020-03-06 08:41:45.947  INFO 8240 --- [           main] com.iron.HelloWorldMainApp               : No active profile set, falling back to default profiles: default
    2020-03-06 08:41:46.152  WARN 8240 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
    2020-03-06 08:41:46.302 ERROR 8240 --- [           main] o.s.boot.SpringApplication               : Application run failed
    
    org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at com.iron.HelloWorldMainApp.main(HelloWorldMainApp.java:11) [classes/:na]
    Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:203) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    	... 8 common frames omitted
    
    
    Process finished with exit code 1
  • 相关阅读:
    下午不想写代码了,写个shelve的模块使用(简单实用的小型数据库)。
    io,pickle,json,一把梭哈,把这三个模块都讲了。
    import 和 __import__的区别
    namedtuple工厂函数,创造一个像实例对象的元祖(感觉到了Python的奇妙与可爱之处)。
    写一下base64字节码转换工具。
    Python加密模块的hashlib,hmac模块介绍。
    简述Orderdict,defaultdcit,ChainMap以及MappingProxyType
    工作中碰到的小问题,如何对列表内的字典排序,以及operator.itemgetter介绍。
    最近在写一个虚拟币搬砖脚本,几条建议备注下。
    Python的re,正则表达式,希望这次比较能让我记住里面的80%以上。(未完成,待继续)
  • 原文地址:https://www.cnblogs.com/vipsoft/p/12424735.html
Copyright © 2011-2022 走看看