org.springframework.cloud
spring-cloud-starter-eureka-server
1.3.2.RELEASE
然后是application:
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaServer
@SpringBootApplication
public class EurekaApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(EurekaApplication.class).web(true).run(args);
}
}
接着是配置文件:
server.port=1111
#eureka.instance.hostname=localhost
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
创建好eureka后,则是实现zuul:
首先是添加pom.xml文件的依赖:
org.springframework.cloud
spring-cloud-starter-zuul
1.3.4.RELEASE
org.springframework.cloud
spring-cloud-starter-eureka
1.3.2.RELEASE
然后是具体的实现,也非常简单:
@EnableZuulProxy
@SpringCloudApplication
public class ZuulApplication {
public static void main(S