增加 eureka 客户端实例
This commit is contained in:
29
examples/eureka-example/pom.xml
Normal file
29
examples/eureka-example/pom.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<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>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.chinaunicom.ebtp</groupId>
|
||||||
|
<artifactId>mall-ebtp-cloud-parent</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>com.chinaunicom.mall.ebtp.cloud</groupId>
|
||||||
|
<artifactId>eureka-example</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>eureka-example</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chinaunicom.ebtp</groupId>
|
||||||
|
<artifactId>mall-ebtp-cloud-eureka-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.chinaunicom.mall.ebtp.cloud.eureka.example;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import com.chinaunicom.mall.ebtp.cloud.eureka.starter.EurekaStarterConfiguration;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@Import(EurekaStarterConfiguration.class)
|
||||||
|
public class EurekaClientApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(EurekaClientApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
12
examples/eureka-example/src/main/resources/application.yml
Normal file
12
examples/eureka-example/src/main/resources/application.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
server:
|
||||||
|
port: 8082
|
||||||
|
max-http-header-size: 1000000
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: eureka-example
|
||||||
|
|
||||||
|
# 胜智云eureka 统一配置 (以下内容已在starter中配置好,如无必要无需定义)
|
||||||
|
# eureka.client.service-url.defaultZone=http://192.168.40.17:12093/eureka/,http://192.168.40.17:18126/eureka/,http://192.168.40.17:28641/eureka/
|
||||||
|
# eureka.instance.prefer-ip-address=true
|
||||||
|
# eureka.instance.instance-id=${spring.cloud.client.ip-address}:${server.port}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.chinaunicom.mall.ebtp.cloud.eureka.example;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8082
|
|
@ -0,0 +1,3 @@
|
|||||||
|
server:
|
||||||
|
port: 8072
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
spring:
|
||||||
|
profiles:
|
||||||
|
active: dev
|
@ -32,5 +32,9 @@
|
|||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chinaunicom.ebtp</groupId>
|
||||||
|
<artifactId>mall-ebtp-cloud-mvc-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
Reference in New Issue
Block a user