don't dream your life, live your dreams !
Please read : Java spring – quickstart
If you use maven, add this to your pom.xml
<dependencies> (...) !-- Spring Cloud starter --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter</artifactId> </dependency> <!-- Eureka for service registration --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka-server</artifactId> </dependency> (...) </dependencies> |
Enable eureka server :
@EnableEurekaServer @EnableDiscoveryClient public class EurekaServerConfiguration { // empty. } |
Enable eureka client :
@EnableEurekaClient @EnableDiscoveryClient public class EurekaClientConfiguration { // empty. } |
Create the file src/main/resources/application.yml :
eureka: instance: leaseRenewalIntervalInSeconds: 10 client: registryFetchIntervalSeconds: 5 serviceUrl: defaultZone: http://${server.hostname}:${server.port}/eureka/ spring.application.name: myservice |
Create the file src/main/resources/boostrap.yml :
spring: cloud: config: enabled: false |
Copyright © 2024 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.
admin