1.Springcloud的Eureka服务端创建步骤
项目地址:
步骤一
引入maven配置,此处的版本号是通过parent里面设定了,我这里用的是
下面就是引用的父类的版本:Dalston.SR1
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
下面使用的是Eureka服务端需要引用的包
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
步骤二
配置application.yml
server:
port: 7001
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
步骤三
启动类添加开启服务注解,开启EurekaServer@EnableEurekaServer
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer7001_App {
public static void main(String[] args) {
SpringApplication.run(EurekaServer7001_App.class,args);
}
}
测试:
可以访问localhost:7001就可以访问eureka的服务页面
正文到此结束