config
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
package com.forezp;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@SpringBootApplication
|
||||
@RestController
|
||||
public class ConfigClientApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConfigClientApplication.class, args);
|
||||
}
|
||||
|
||||
@Value("${foo}")
|
||||
String foo;
|
||||
@RequestMapping(value = "/hi")
|
||||
public String hi(){
|
||||
return foo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
spring.application.name=config-client
|
||||
spring.cloud.config.label=master
|
||||
spring.cloud.config.profile=dev
|
||||
spring.cloud.config.uri= http://localhost:8888/
|
||||
server.port=8881
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.forezp;
|
||||
|
||||
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 ConfigClientApplicationTests {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user