1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

polish #761 update pkg name & maven coordinate for Finchley

This commit is contained in:
fangjian0423
2019-07-23 23:16:42 +08:00
parent 12d4b3f60e
commit c459080f05
652 changed files with 12275 additions and 11471 deletions

View File

@@ -3,7 +3,7 @@
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>
<groupId>com.alibaba.cloud</groupId>
<artifactId>nacos-discovery-example</artifactId>
<version>0.2.3.BUILD-SNAPSHOT</version>
</parent>
@@ -21,7 +21,7 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
@@ -41,7 +41,7 @@
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

View File

@@ -1,9 +1,7 @@
package org.springframework.cloud.alibaba.cloud.examples;
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.alibaba.cloud.examples.ConsumerApplication.EchoService;
import org.springframework.cloud.alibaba.sentinel.annotation.SentinelRestTemplate;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
@@ -15,6 +13,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import com.alibaba.cloud.examples.ConsumerApplication.EchoService;
import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
/**
* @author xiaojing
*/

View File

@@ -1,7 +1,6 @@
package org.springframework.cloud.alibaba.cloud.examples;
package com.alibaba.cloud.examples;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.alibaba.cloud.examples.ConsumerApplication.EchoService;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -10,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.alibaba.cloud.examples.ConsumerApplication.EchoService;
/**
* @author xiaojing
*/
@@ -19,8 +20,8 @@ public class TestController {
@Autowired
private RestTemplate restTemplate;
@Autowired
private RestTemplate restTemplate1;
@Autowired
private RestTemplate restTemplate1;
@Autowired
private EchoService echoService;
@@ -28,20 +29,20 @@ public class TestController {
@Autowired
private DiscoveryClient discoveryClient;
// @PostConstruct
// public void init() {
// restTemplate1.setErrorHandler(new ResponseErrorHandler() {
// @Override
// public boolean hasError(ClientHttpResponse response) throws IOException {
// return false;
// }
//
// @Override
// public void handleError(ClientHttpResponse response) throws IOException {
// System.err.println("handle error");
// }
// });
// }
// @PostConstruct
// public void init() {
// restTemplate1.setErrorHandler(new ResponseErrorHandler() {
// @Override
// public boolean hasError(ClientHttpResponse response) throws IOException {
// return false;
// }
//
// @Override
// public void handleError(ClientHttpResponse response) throws IOException {
// System.err.println("handle error");
// }
// });
// }
@RequestMapping(value = "/echo-rest/{str}", method = RequestMethod.GET)
public String rest(@PathVariable String str) {
@@ -49,20 +50,20 @@ public class TestController {
String.class);
}
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index() {
return restTemplate1.getForObject("http://service-provider", String.class);
}
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index() {
return restTemplate1.getForObject("http://service-provider", String.class);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public String test() {
return restTemplate1.getForObject("http://service-provider/test", String.class);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public String test() {
return restTemplate1.getForObject("http://service-provider/test", String.class);
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
return restTemplate1.getForObject("http://service-provider/sleep", String.class);
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
return restTemplate1.getForObject("http://service-provider/sleep", String.class);
}
@RequestMapping(value = "/notFound-feign", method = RequestMethod.GET)
public String notFound() {

View File

@@ -3,7 +3,7 @@
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>
<groupId>com.alibaba.cloud</groupId>
<artifactId>nacos-discovery-example</artifactId>
<version>0.2.3.BUILD-SNAPSHOT</version>
</parent>
@@ -21,7 +21,7 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

View File

@@ -1,4 +1,4 @@
package org.springframework.cloud.alibaba.cloud.examples;
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -25,25 +25,26 @@ public class ProviderApplication {
@RestController
class EchoController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public ResponseEntity index() {
return new ResponseEntity("index error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public ResponseEntity index() {
return new ResponseEntity("index error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public ResponseEntity test() {
return new ResponseEntity("error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/test", method = RequestMethod.GET)
public ResponseEntity test() {
return new ResponseEntity("error", HttpStatus.INTERNAL_SERVER_ERROR);
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
return "ok";
}
@RequestMapping(value = "/sleep", method = RequestMethod.GET)
public String sleep() {
try {
Thread.sleep(1000L);
}
catch (InterruptedException e) {
e.printStackTrace();
}
return "ok";
}
@RequestMapping(value = "/echo/{string}", method = RequestMethod.GET)
public String echo(@PathVariable String string) {

View File

@@ -3,14 +3,14 @@
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>
<groupId>com.alibaba.cloud</groupId>
<artifactId>nacos-discovery-example</artifactId>
<version>0.2.3.BUILD-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nacos-discovery-with-spring-cloud-config-example</artifactId>
<artifactId>nacos-discovery-spring-cloud-config-client</artifactId>
<packaging>jar</packaging>
<description>Example demonstrating how to use nacos discovery</description>
@@ -21,7 +21,7 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.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;
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.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 SpringCloudConfigClientApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCloudConfigClientApplication.class, args);
}
}

View File

@@ -0,0 +1,59 @@
<?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>com.alibaba.cloud</groupId>
<artifactId>nacos-discovery-example</artifactId>
<version>0.2.3.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-config-server</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</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>

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.cloud.examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.config.server.EnableConfigServer;
/**
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableConfigServer
public class SpringCloudConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCloudConfigServerApplication.class, args);
}
}

View File

@@ -0,0 +1,15 @@
server:
port: 7070
spring:
application:
name: configserver
cloud:
nacos:
discovery:
server-addr: localhost:8848
config:
server:
git:
uri: https://github.com/fangjian0423/blogimages
search-paths: /

View File

@@ -1,19 +0,0 @@
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;
}
}

View File

@@ -1,18 +0,0 @@
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);
}
}

View File

@@ -3,7 +3,7 @@
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>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-examples</artifactId>
<version>0.2.3.BUILD-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
@@ -19,6 +19,7 @@
<modules>
<module>nacos-discovery-consumer-example</module>
<module>nacos-discovery-provider-example</module>
<module>nacos-discovery-with-spring-cloud-config-example</module>
<module>nacos-discovery-spring-cloud-config-client</module>
<module>nacos-discovery-spring-cloud-config-server</module>
</modules>
</project>

View File

@@ -15,7 +15,7 @@
1. 首先,修改 pom.xml 文件,引入 Nacos Discovery Starter。
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

View File

@@ -14,7 +14,7 @@ Before we start the demo, let's learn how to connect Nacos Config to a Spring Cl
1. Add dependency spring-cloud-starter-alibaba-nacos-discovery in the pom.xml file in your Spring Cloud project.
<dependency>
<groupId>org.springframework.cloud</groupId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>