正常的情况是先加载yml,接下来加载properties文件。如果相同的配置存在于两个文件中。最后会使用properties中的配置。最后读取的优先集最高。

   两个配置文件中的端口号不一样会读取properties中的端口号。

我在 application.properties 文件中配置了:

server.port=8085

 

在 application.yml 文件中配置了:

server:

  port: 8086

启动项目,控制台输出:

main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8085 (http)

充分说明了这一点。

转载自https://blog.csdn.net/wangmx1993328/article/details/81005170

  

相关文章:

  • 2021-08-14
  • 2022-12-23
  • 2021-11-24
  • 2021-10-26
  • 2022-12-23
  • 2021-11-27
  • 2021-11-17
猜你喜欢
  • 2021-10-21
  • 2022-01-07
  • 2023-02-17
  • 2022-12-23
  • 2021-04-02
  • 2022-12-23
相关资源
相似解决方案