小编vin*_*ent的帖子

命令行中的server.port无法使用spring cloud config server和eureka server

我正在研究春天可​​以.我现在拥有的是spring cloud配置服务器和eureka服务器.

配置服务器的代码

@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

application.properties

spring.application.name=config-server
spring.cloud.config.server.git.uri=https://github.com/vincentwah/spring-cloud-config-repository/
server.port=7001
Run Code Online (Sandbox Code Playgroud)

Eureka服务器的代码

@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

bootstrap.properties

spring.application.name=eureka-server
spring.cloud.config.uri=http://localhost:7001/
Run Code Online (Sandbox Code Playgroud)

eureka-server的配置是https://github.com/vincentwah/spring-cloud-config-repository/blob/master/eureka-server.properties

eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
server.port=1111
Run Code Online (Sandbox Code Playgroud)

当我启动eureka服务器时,我想更改端口,所以我运行下面的命令

java -jar target/eureka-server-0.0.1-SNAPSHOT.jar --server.port=1234
Run Code Online (Sandbox Code Playgroud)

但是,服务器仍然使用端口1111启动

2017-01-03 14:04:11.324  INFO 6352 --- [      Thread-10] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2017-01-03 14:04:11.339  INFO 6352 --- [      Thread-10] e.s.EurekaServerInitializerConfiguration : Started Eureka Server …
Run Code Online (Sandbox Code Playgroud)

spring-boot spring-cloud netflix-eureka

4
推荐指数
1
解决办法
1551
查看次数

标签 统计

netflix-eureka ×1

spring-boot ×1

spring-cloud ×1