SpringCloud微服务----Eureka

springcloud中文网: https://springcloud.cc/

创建Eureka服务

一 、创建一个基础的Spring Boot工程,并在pom.xml中引入需要的依赖内容


    org.springframework.boot
    spring-boot-starter-parent
    1.3.5.RELEASE
     



    
        org.springframework.boot
	spring-boot-starter-test
	test
    

    
        org.springframework.cloud
	spring-cloud-starter-eureka-server
    



    
        
	    org.springframework.cloud
	    spring-cloud-dependencies
	    Brixton.RELEASE
	    pom
	    import
	
    

二、入口添加@EnableEurekaServer注解

@EnableEurekaServer
@SpringBootApplication
public class Application {

	public static void main(String[] args) {
		new SpringApplicationBuilder(Application.class).web(true).run(args);
	}

}

添加配置文件

application.properties或者application.yml中问增加如下配置

这里演示的application.properties中的配置

server.port=1111   //端口
eureka.client.register-with-eureka=false //
eureka.client.fetch-registry=false
eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
 

未完待续。。。。。。

 

 

 

 

你可能感兴趣的:(架构)