私は春を勉強しています。私が今持っているのは、春のクラウド設定サーバーとユーレカサーバーです。コマンドラインのserver.portがSpringクラウド設定サーバーとユーレカサーバーで動作しない
構成サーバーのコードユーレカサーバーの
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
application.properties
spring.application.name=config-server
spring.cloud.config.server.git.uri=https://github.com/vincentwah/spring-cloud-config-repository/
server.port=7001
コード
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
bootstrap.properties
spring.application.name=eureka-server
spring.cloud.config.uri=http://localhost:7001/
ユーレカ・サーバーの設定は、私はユーレカ・サーバを起動すると、私はポートを変更したいのですが、私は
java -jar target/eureka-server-0.0.1-SNAPSHOT.jar --server.port=1234
ただし、コマンドの下に実行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
で、サーバがありますまだポート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
2017-01-03 14:04:11.492 INFO 6352 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 1111 (http)
2017-01-03 14:04:11.493 INFO 6352 --- [ main] c.n.e.EurekaDiscoveryClientConfiguration : Updating port to 1111
2017-01-03 14:04:11.500 INFO 6352 --- [ main] com.example.EurekaServerApplication : Started EurekaServerApplication in 27.532 seconds (JVM running for 29.515)
私はコマンドラインで--server.portに間違っていないと思います。誰も同じ問題に遭遇しますか?
どのOSですか? '--SERVER_PORT = 1234'を試してください。 –
Windows 7 +スプリングブート1.4.3。私は - SERVER_PORT = 1234を試しましたが、動作しません。 https://github.com/vincentwah/spring-boot/tree/master/config-serverとhttps:// githubにソースコードがあります。 – vincent
設定サーバーからプロパティーを取得していることに気がつきました。正しくリコールすれば、他の定義済みのプロパティーよりも優先されます。 –