Why can't Springboot load the configuration file of application.yml

Problem: application.yml configures

# tomcat端口
server:
  port: 80

But after the project starts, the port is always 8080 (modify Tomcat's default 8080 port)

Solution 1

The configuration of the pom.xml file is incorrect,

Error: <packaging>pom</packaging>

Correct: <packaging>jar</packaging>

Solution 2

Configuration file name is wrong

Error: applicaton.yml

Correct: application.yml

Solution 3

execute maven command

Execute clean first

while executing install

 

Guess you like

Origin blog.csdn.net/qq_39997939/article/details/123023892