Check out the full series of Questions Management tutorial here.
After creating the support-discovery-server project, it’s time to use Spring Cloud Netflix to enable the Eureka Server for this Support Discovery Server.
As I have instructed you in the tutorial Learn about Eureka Server of Netflix OSS, what we need to do is:
Add the Spring Cloud Netflix @EnableEurekaServer annotation in the SupportDiscoveryServerApplication class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
package com.huongdanjava.discoveryserver; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @SpringBootApplication public class SupportDiscoveryServerApplication { public static void main(String[] args) { SpringApplication.run(SupportDiscoveryServerApplication.class, args); } } |
Add to the application.properties file the following information:
1 2 3 4 5 6 |
spring.application.name=Support Discovery Server server.port=8761 eureka.client.register-with-eureka=false eureka.client.fetch-registry=false |
In addition to the information needed to enable a Eureka Server, as you can see, I also named this service “Support Discovery Server”.
Now you can try to start this project and see the results.
Myself is as follows: