mirror of
https://github.com/ityouknow/spring-cloud-examples.git
synced 2025-12-08 19:25:55 +00:00
m
This commit is contained in:
parent
3662ed96b2
commit
54ee39dcaa
@ -7,6 +7,8 @@ Spring cloud使用的各种示例,以最简单、最实用为标准
|
||||
- [service-producer-consumer](https://github.com/ityouknow/spring-cloud-starter/tree/master/service-producer-consumer):利用eureka实现服务提供与调用demo
|
||||
- [spring-cloud-hystrix](https://github.com/ityouknow/spring-cloud-starter/tree/master/spring-cloud-hystrix):Hystrix熔断的使用示例
|
||||
- [hystrix-dashboard-turbine](https://github.com/ityouknow/spring-cloud-starter/tree/master/hystrix-dashboard-turbine):熔断监控Hystrix Dashboard和Turbine的示例
|
||||
-[springcloud(六):配置中心](https://github.com/ityouknow/spring-cloud-starter/tree/master/spring-cloud-config):配置中心服务端提供配置中心服务客户端去调用的例子
|
||||
|
||||
|
||||
|
||||
|
||||
@ -19,6 +21,7 @@ Spring cloud使用的各种示例,以最简单、最实用为标准
|
||||
- [springcloud(三):服务提供与调用](http://www.ityouknow.com/springcloud/2017/05/12/service-provider-constomer.html)
|
||||
- [springcloud(四):熔断器Hystrix](http://www.ityouknow.com/springcloud/2017/05/16/springcloud-hystrix.html)
|
||||
- [springcloud(五):熔断监控Hystrix Dashboard和Turbine](http://www.ityouknow.com/springcloud/2017/05/18/hystrix-dashboard-turbine.html)
|
||||
- [springcloud(六):配置中心](http://www.ityouknow.com/springcloud/2017/05/22/springcloud-config.html)
|
||||
|
||||
> 如果大家想了解关于springcloud的其它方面应用,也可以以issues的形式反馈给我,我后续来完善。
|
||||
|
||||
|
||||
66
spring-cloud-config/spring-cloud-config-client/pom.xml
Normal file
66
spring-cloud-config/spring-cloud-config-client/pom.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.neo</groupId>
|
||||
<artifactId>spring-cloud-config-client</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>spring-cloud-config-client</name>
|
||||
<description>Demo project for Spring cloud config</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.3.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,13 @@
|
||||
package com.neo;
|
||||
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ConfigClientApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ConfigClientApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.neo.web;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
class HelloController {
|
||||
|
||||
@Value("${neo.hello}")
|
||||
private String hello;
|
||||
|
||||
@RequestMapping("/hello")
|
||||
public String from() {
|
||||
return this.hello;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
spring.application.name=spring-cloud-config-client
|
||||
server.port=8002
|
||||
@ -0,0 +1,8 @@
|
||||
spring.cloud.config.name=neo-config
|
||||
spring.cloud.config.profile=dev
|
||||
spring.cloud.config.uri=http://localhost:8001/
|
||||
spring.cloud.config.label=master
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package com.neo;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class ApplicationTests {
|
||||
|
||||
@Value("${neo.hello}")
|
||||
private String hello;
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
System.out.println("************************************************************");
|
||||
System.out.println("hello value : "+hello);
|
||||
System.out.println("************************************************************");
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user