xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
最主要是要有
com.netflix.eureka 和 com.thoughtworks.xstream
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication{
public static void main(String[] args) {
new SpringApplicationBuilder(EurekaServerApplication.class)
.web(true).run(args);
}
}
application.properties
的内容如下:
spring.application.name=eureka-server
server.port=1001
eureka.instance.hostname=localhost
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
运行成功后,就可以通过http://127.0.0.1:1001看到 spring cloud server Eureka