Eureka Server
application.properties
server.port=8761 eureka.client.register-with-eureka=false eureka.client.fetchRegistry=false
POM.xml
4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.4.RELEASE com.example Tuto10EurekaServer01 0.0.1-SNAPSHOT Tuto10EurekaServer01 Demo project for Spring Boot 1.8 Greenwich.SR1 org.springframework.cloud spring-cloud-starter-netflix-eureka-server org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin
Tuto10EurekaServer01Application
package com.example.eurekaclient01; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class Tuto10EurekaServer01Application { public static void main(String[] args) { SpringApplication.run(Tuto10EurekaServer01Application.class, args); } }
Eureka Client
application.properties
spring.application.name=myclient-service
POM.xml
4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.4.RELEASE com.example Tuto10EurekaClient01 0.0.1-SNAPSHOT Tuto10EurekaClient01 Demo project for Spring Boot 1.8 Greenwich.SR1 org.springframework.boot spring-boot-starter-web org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin
Tuto10EurekaClient01Application
package com.example.eurekaclient01; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableEurekaClient public class Tuto10EurekaClient01Application { public static void main(String[] args) { SpringApplication.run(Tuto10EurekaClient01Application.class, args); } }
MyClient
package com.example.eurekaclient01; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class MyClient { @RequestMapping("/hello") public String Hello() { return "Hello world from the client"; } }
This is just a trick, hope it paved your way out.
Looking for the Best Minecraft Server to play on? Want to advertise your minecraft server? Find them right here on our Minecraft Multiplayer Servers List. Cheap Minecraft Advertising
ReplyDelete