即使更改后,Spring Boot服务器端口仍可在8080上使用

时间:2019-04-20 13:46:42

标签: spring-boot tomcat

在我的一个项目中,我已将server.port的值更改为8081,奇怪的是,每次运行它都会坚持为8080。我试图重建该项目,但仍然拒绝在8080以外的任何其他端口上运行。

我还有其他项目,其端口配置为8082和8083,可以正常工作。我怀疑这是一个无法解决的缓存问题,因为我首先在8080上运行该项目,然后将set server.port更改为8081

启动日志

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.4.RELEASE)

2019-04-20 19:24:24.253  INFO 4148 --- [           main] i.j.m.MovieCatalogServiceApplication     : Starting MovieCatalogServiceApplication on mobiuso-3.local with PID 4148 (/Users/pavitardua/projects/microservices/movie-catalog-service/target/classes started by pavitardua in /Users/pavitardua/projects/microservices/movie-catalog-service)
2019-04-20 19:24:24.256  INFO 4148 --- [           main] i.j.m.MovieCatalogServiceApplication     : No active profile set, falling back to default profiles: default
2019-04-20 19:24:25.428  INFO 4148 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-04-20 19:24:25.463  INFO 4148 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-04-20 19:24:25.463  INFO 4148 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.17]
2019-04-20 19:24:25.558  INFO 4148 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-04-20 19:24:25.559  INFO 4148 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1259 ms
2019-04-20 19:24:25.797  INFO 4148 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-04-20 19:24:25.990  INFO 4148 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-04-20 19:24:25.995  INFO 4148 --- [           main] i.j.m.MovieCatalogServiceApplication     : Started MovieCatalogServiceApplication in 7.243 seconds (JVM running for 7.755)

1 个答案:

答案 0 :(得分:0)

这可能会为像我这样的IntelliJ新手节省一些时间。 转到文件->使高速缓存无效并重新启动->使无效并重新启动。

这帮了我大忙。