Spring Boot jar 启动错误“due to missing embeddedServletContainerFactory.bean”
2017-06-05 19:59
477 查看
最近在学习使用Spring Boot ,感觉非常方便。
代码的测试工作一般都是intellij idea里进行。
试了下使用 mvn package 打成jar包时,在cmd中使用“java -jar **.jar” 运行时报“due to missing embeddedServletContainerFactory.bean...” 错误。
经查询,主要是注解没有用对。
在Spring Boost的main方法中添加
注解。
@Controller
@SpringBootConfiguration
@SpringBootApplication
public class SampleController {
@RequestMapping("/")
@ResponseBody
public String home() {
return "Hello world!";
}
public static void main(String[] args) {
SpringApplication.run(SampleController.class,args);
}
}
然后再打包运行即可。
新接触这个框架,根据Spring Boot Reference Guide进行学习,不懂得地方在此记录一下。轻喷。
代码的测试工作一般都是intellij idea里进行。
试了下使用 mvn package 打成jar包时,在cmd中使用“java -jar **.jar” 运行时报“due to missing embeddedServletContainerFactory.bean...” 错误。
经查询,主要是注解没有用对。
在Spring Boost的main方法中添加
@SpringBootApplication
注解。
@Controller
@SpringBootConfiguration
@SpringBootApplication
public class SampleController {
@RequestMapping("/")
@ResponseBody
public String home() {
return "Hello world!";
}
public static void main(String[] args) {
SpringApplication.run(SampleController.class,args);
}
}
然后再打包运行即可。
新接触这个框架,根据Spring Boot Reference Guide进行学习,不懂得地方在此记录一下。轻喷。
相关文章推荐
- IDEA启动Spring Boot项目提示Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServlet...
- Spring Boot: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFa
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- SpringbootUnable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFact
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- IDEA启动spring boot 出现Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletCont
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory Bean
- Spring Cloud | Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainer
- 从eclipse中导入到IDEA中的SpringBoot项目,启动时报错 Unable to start EmbeddedWebApplicationContext due to missing Em