idea创建springcloud项目图文教程(EurekaServer注册中心)(六)

上一篇: 

idea创建springboot项目图文教程(配置文件)(五)

      http://blog.csdn.net/hcmony/article/details/77854999

idea创建springcloud项目图文教程(EurekaServer注册中心)(六)

1,new -project 选择spring initializr

idea创建springcloud项目图文教程(EurekaServer注册中心)(六)


2,创建自己的包名,类名。

idea创建springcloud项目图文教程(EurekaServer注册中心)(六)



3,这一步与创建springboot有区别,画重点了,注意下面的两个红框框

idea创建springcloud项目图文教程(EurekaServer注册中心)(六)


4,项目名

idea创建springcloud项目图文教程(EurekaServer注册中心)(六)


5,SpringcloudDemoApplication.java  启动类。

package com.hcmony;

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

@EnableEurekaServer
@SpringBootApplication
public class SpringcloudDemoApplication {

   public static void main(String[] args) {
      SpringApplication.run(SpringcloudDemoApplication.class, args);
   }
}

6,application.properties的配置文件 。

server.port=8761
eureka.instance.hostname=192.168.18.163
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.service-url.defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

7,可以启动了。