nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.报错解决

Recent experience when I learn springboot, learned this wrong, a lot of online search, not changed, and later found his class configuration does not add @SpringBootApplication comment

 

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.

 

2019-10-03 21:22:36.066 ERROR 6408 --- [           main] o.s.boot.SpringApplication               : Application run failed

package com.example.demo.freemarker;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @Description :
 * @Author:
 * @Date: 2019/10/3 21:13
 */
@SpringBootApplication
public class AppConfig {
    public static void main(String[] args) {

        SpringApplication.run(AppConfig.class,args);
    }
}

 

nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

Guess you like

Origin www.cnblogs.com/liruilong/p/11620850.html