问题:
1.server.port不生效
2.配置文件不生效
解决:
1.看看是不是配置对应不上:
读取环境配置dev(开发)/pro(生产)/test(测试)
spring.profiles.active=dev
2.使用idea打开一个项目project,在菜单栏选择Build菜单,然后选择Rebuild project对项目进行重新编译
3.看看calss底下是否有配置文件没有加上:
<build> <finalName>xxgz-eureka</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> <!-- 调试注释 提交代码时打开--> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>*.yml</include> <include>**/*.yml</include> </includes> <!-- <excludes> <exclude>**/*.properties</exclude> <exclude>**/*.yml</exclude> <exclude>*.properties</exclude> <exclude>*.conf</exclude> <exclude>*.yml</exclude> <exclude>generator/*.*</exclude> </excludes> --> </resource> </resources> </build>
从新编译如图: