我在主类上添加了注释,如下所示:package com.main;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;import org.springframework.web.bind.annotation.CrossOrigin;import com.controller.RequestClass;@CrossOrigin(origins = "http://localhost:4200")@SpringBootApplication@Configuration@EnableAutoConfiguration@ComponentScan("com.*")public class MainClass{ public static void main(String[] args) { SpringApplication.run(RequestClass.class, args); }}但是在运行该应用程序时,会遇到以下错误。请让我知道是否需要任何其他文件进行调试2018-07-08 14:16:27.321 INFO 7832 --- [main] com.main.MainClass:使用PID 7832在DESKTOP-551C51M上启动MainClass(C:\ Users \ sparsh \ eclipse-workspace \ firstprogram \ target \ classes由sparsh在C:\ Users \ sparsh \ eclipse-workspace \ firstprogram中启动)2018-07-08 14:16:27.327 INFO 7832 --- [main] com.main.MainClass:未设置活动配置文件,恢复为默认设置概要文件:默认2018-07-08 14:16:27.382信息7832 --- [主] ConfigServletWebServerApplicationContext:刷新org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@2893de87:启动日期[星期日Jul 08 14:16: 27 IST 2018];上下文层次结构的根2018-07-08 14:16:27。611 WARN 7832 --- [main] ConfigServletWebServerApplicationContext:上下文初始化期间遇到异常-取消刷新尝试:org.springframework.context.ApplicationContextException:无法启动Web服务器;无法启动Web服务器。嵌套的异常是org.springframework.context.ApplicationContextException:由于缺少ServletWebServerFactory bean而无法启动ServletWebServerApplicationContext。2018-07-08 14:16:27.974错误7832 --- [main] osboot.SpringApplication:应用程序运行失败 由于缺少ServletWebServerFactory bean,因此无法启动ServletWebServerApplicationContext。2018-07-08 14:16:27.974错误7832 --- [main] osboot.SpringApplication:应用程序运行失败 由于缺少ServletWebServerFactory bean,因此无法启动ServletWebServerApplicationContext。2018-07-08 14:16:27.974错误7832 --- [main] osboot.SpringApplication:应用程序运行失败
添加回答
举报
0/150
提交
取消