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

标签 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)

最佳答案

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

这对我有用。

关于spring-boot - 即使更改后,Spring Boot 服务器端口仍可在 8080 上使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55774139/

相关文章:

Java/MSSQL : java. sql.SQLException 对象名称无效 'TableName'

java - 在序列化之前检索 RabbitMQ 消息(审核)

java - Spring Boot post HTTP 请求

java - Spring 启动 Thymeleaf : How to include html file

mongodb - react 性存储库不保存对象

java - 我应该在 Web 应用程序中的什么地方放置清理代码?

java - Tomcat 7 启动时无连接时 CPU 使用率较高

tomcat - DSPACE:tomcat 重启后 xmlui 出现白屏

spring - 使用 Spring 数据 MongoDB @Document 创建一个上限集合

java - Infinispan 因 java.lang.NoSuchMethodError : org. jboss.marshalling.MarshallingConfiguration.setExternalizerCreator 崩溃