网关开发过程中bug分析

134 阅读1分钟

1. 启动springboot过程中发现这样的报错

2023-02-13 21:03:27.891  INFO 19391 --- [           main] c.b.g.center.ApiGatewayApplication       : Starting ApiGatewayApplication using Java 1.8.0_351 on QXIT-PC-001231.local with PID 19391 (/Users/dingyawu/mycoderepo/api-gateway-center-master/api-gateway-center-01/target/classes started by dingyawu in /Users/dingyawu/mycoderepo/api-gateway-center-master)
2023-02-13 21:03:27.893  INFO 19391 --- [           main] c.b.g.center.ApiGatewayApplication       : No active profile set, falling back to default profiles: default
2023-02-13 21:03:28.790  INFO 19391 --- [           main] c.b.g.center.ApiGatewayApplication       : Started ApiGatewayApplication in 1.295 seconds (JVM running for 1.795)
Disconnected from the target VM, address: '127.0.0.1:60321', transport: 'socket'

原因分析

  1. 由于拉取的是别人的代码,直接启动启动类了,就报这个错误,搞了好久,后来看了pom,心里真的是热了狗,他把tomcat移除了
  2. 改了pom以后记得reload,之后才能build
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>