mvl*_*pan 2 spring spring-boot spring-cloud
我们正在尝试为我们的应用程序创建一个仪表板,作为单点输入/配置。为此,我们将构建和UI,并希望在同一实例上运行Spring Cloud Config和Eureka。有什么理由我们不应该这样做,如果不能,那么有可能吗?
@mvlupan,没有什么可以阻止您一起使用。这就是我们创建@EnableEurekaServer和的原因之一@EnableConfigServer。
pom.xml 片段。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
Application.java 片段
@EnableEurekaServer
@EnableConfigServer
@SpringBootApplication
public class DemoconfigandeurekaserverApplication { /*...*/}
Run Code Online (Sandbox Code Playgroud)
application.properties 片段(因此eureka和配置服务器不会冲突)。
spring.cloud.config.server.prefix=/config
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
697 次 |
| 最近记录: |