1.pom.xml

有spring cloud b2b2c电子商务需求的朋友可以加企鹅求求:三五三六二四七二五九

  
4.0.0  

com.hive  
user-eureka  
0.0.1-SNAPSHOT  
jar  

eureka_user  
http://maven.apache.org  

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

  
  
UTF-8  

1.8  
  
  

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

  
  
  
  
org.springframework.cloud  
spring-cloud-dependencies  
Camden.SR1  
pom  
import  
  
  
  
  
  
  
  
org.springframework.boot  
spring-boot-maven-plugin  
  
  
  
  

2.application

package com.hivescm;  

import org.springframework.boot.SpringApplication;  
import org.springframework.boot.autoconfigure.SpringBootApplication;  
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;  

@SpringBootApplication//springBoot注解,spring在springBoot基础之上来构建项目  
@EnableEurekaServer//开启eureka服务  
public class EurekaApplication {  
public static void main(String[] args) {  

//spirng boot的标准入口  
SpringApplication.run(EurekaApplication.class, args);  
}  
}  

3.application.yml

server:  
port: 8761#指定服务端口  
eureka:  
client:  
register-with-eureka: false #是否将eureka自身作为应用注册到eureka注册中心  
fetch-registry: false #为true时,可以启动,但报异常:Cannot execute request on any known server  
service-url:  
defaultZone: http://192.168.106.49:8761/eureka  

简单的eureka就写好了,运行下EurekaApplication .java

访问:http://localhost:8761/有spring cloud b2b2c电子商务需求的朋友可以加企鹅求求:三五三六二四七二五九