example for issue #714 to validate the pr

pull/714/head
Jevon Yang 6 years ago
parent ea6ecb8be1
commit f4f407b84c

@ -0,0 +1,62 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>nacos-discovery-example</artifactId>
<version>0.9.1.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nacos-discovery-with-spring-cloud-config-example</artifactId>
<packaging>jar</packaging>
<description>Example demonstrating how to use nacos discovery</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,19 @@
package org.springframework.cloud.alibaba.cloud.examples;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GetConfigController {
@Value("${config}")
private String config;
@RequestMapping(value = "/config", method = RequestMethod.GET)
public String getConfig() {
return config;
}
}

@ -0,0 +1,18 @@
package org.springframework.cloud.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author JevonYang
*/
@SpringBootApplication
@EnableDiscoveryClient
public class NacosDiscoverySpringConfigApplication {
public static void main(String[] args) {
SpringApplication.run(NacosDiscoverySpringConfigApplication.class, args);
}
}

@ -0,0 +1,10 @@
spring:
application:
name: client
cloud:
nacos:
discovery:
server-addr: localhost:8848
config:
discovery:
enabled: true

@ -19,5 +19,6 @@
<modules>
<module>nacos-discovery-consumer-example</module>
<module>nacos-discovery-provider-example</module>
<module>nacos-discovery-with-spring-cloud-config-example</module>
</modules>
</project>

Loading…
Cancel
Save