我已经在我的一个项目中将 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/