I am a programmer but I hate grammar. Here you will find what I did, doing , will do ... Scattered pieces of knowledge that I have deleted from my mind to the trash bin through out my boring daily coding life. I will also report some of my failures in life so dear to me not success, because I have always learnt much only when I fail.
Sunday, April 28, 2019
10 Spring Boot Install Eureka Server and Client in STS SOLVED
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.
Monday, April 22, 2019
Friday, April 19, 2019
Subscribe to:
Comments (Atom)