尝试使用http://${eureka.hostname}:${server.port}/
设置实例homePageUrl url,以使zuul转发请求但出现异常:
java.net.MalformedURLException:对于输入字符串:“ $ {server.port}”
请告诉我我在做什么错。
management:
context-path:
port : ${MANAGEPORT:9000}
ssl :
enabled : false
server:
port : ${PORT:8080}
endpoints:
enabled: "true"
health:
enabled: "true"
sensitive: "false"
info:
enabled: "true"
sensitive: "false"
metrics:
enabled: "true"
logfile:
enabled: "true"
restart:
enabled: true
#Eureka Client configuration
eureka:
client:
healthcheck:
enabled: "true"
sensitive: "true"
registerWithEureka: true
fetchRegistry: true
useDnsForFetchingServiceUrls: false
serviceUrl:
defaultZone: "http://${DISCOVERYAPP:localhost}:${DISCOVERYPORT:8761}/eureka/"
instance:
preferIpAddress: true
statusPageUrl: http://${eureka.hostname}:9000/info
healthCheckUrl: http://${eureka.hostname}:9000/health
homePageUrl: "http://${eureka.hostname}:${server.port}/"
instanceId: "${spring.application.name}:${spring.application.instance_id:${random.value}}"
metadataMap:
tenant: "${tenant:default}"
management :
port : ${management.port}
context-path : ${management.context-path}
这里是例外:
java.net.MalformedURLException:对于输入字符串:“ $ {server.port}”
这是pom.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0 org.springframework.boot 弹簧启动启动器父母 1.5.18发布 com.xxx.enterprise 认证服务器 0.0.1-快照 认证服务器 验证服务器
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Edgware.SR5</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>