@SpringBootApplication
@EnableDiscoveryClient
public class ServiceGatewayApplication {
public static void main(String[] args) {
try {
ConfigurableApplicationContext application = SpringApplication.run(ServiceGatewayApplication.class, args);
}catch (Exception e){
System.out.println(e.toString());
}
}
}
在启动类上加上try-catch,并将异常打印出来,根据异常的情况做具体的处理。
自己遇到的情况:
在学习微服务的过程中;使用此方法报了“Failed to start bean 'webServerStartStop'; ”异常
发现原因为:配置了nacos 而nacos 却未启动。