BAEL-5268 - Using Profiles with Discovery Clients (#11913)
* BAEL-5268 - Using Profiles with Discovery Clients * BAEL-5268 - Adding separate property file for dev environment Co-authored-by: Abhinav Pandey <Abhinav2.Pandey@airtel.com>
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
package com.baeldung.spring.cloud.eureka.client;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class EurekaClientApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EurekaClientApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.baeldung.spring.cloud.eureka.client.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class HelloWorldController {
|
||||
|
||||
@RequestMapping("/hello")
|
||||
public String hello() {
|
||||
return "Hello World!";
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
server.port=8080
|
||||
spring.cloud.discovery.enabled=false
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
server.port=8080
|
||||
|
||||
eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://localhost:8761/eureka}
|
||||
eureka.instance.preferIpAddress=false
|
||||
|
||||
spring.application.name=spring-cloud-eureka-client
|
||||
#---
|
||||
spring.config.activate.on-profile=dev
|
||||
spring.cloud.discovery.enabled=false
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.baeldung.spring.cloud.eureka.client;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class SpringContextTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user