当时eureka服务在父工程下,但是无论怎么开启服务,都是走的默认端口(8080),没有使用我给配置的端口。
报错:
Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}
也就表明没有读到配置文件,而且在我的target文件中没有编译配置文件:
解决方式:
步骤一:
在父类pom添加如下配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.*</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
</build>
步骤二:
删除掉当前模块中(如果写了的话),pom文件中的:
<packaging>pom</packaging>
结果,编译了配置文件: