1. 增加了apollo 配置中心使用的 demo

2. 调整了apollo starter的pom, 增加了对于mvc starter的依赖
This commit is contained in:
Administrator
2020-10-29 10:47:42 +08:00
parent b9a0dd86f4
commit 4518c665f9
12 changed files with 177 additions and 10 deletions

View File

@ -0,0 +1,14 @@
package com.chinaunicom.mall.ebtp.cloud.apollo.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
@EnableApolloConfig
@SpringBootApplication
public class ApolloExampleApplication {
public static void main(String[] args) {
SpringApplication.run(ApolloExampleApplication.class, args);
}
}

View File

@ -0,0 +1,18 @@
package com.chinaunicom.mall.ebtp.cloud.apollo.example.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/apollo")
public class ApolloExampleController {
private @Value("${example.apollo.message:not found message}") String message;
@RequestMapping("/message")
public String message() {
return message;
}
}

View File

@ -0,0 +1,16 @@
server:
port: 8762
max-http-header-size: 1000000
app:
id: mall-ebtp-cloud-demo
example:
apollo:
message: default
# Apollo 配置信息 (以下为starter默认配置信息)
# apollo.meta=http://106.74.154.90:9228/
# apollo.bootstrap.namespace=application
# apollo.bootstrap.enabled=true
# apollo.bootstrap.eagerLoad.enabled=true

View File

@ -0,0 +1,3 @@
spring:
profiles:
active: dev

View File

@ -0,0 +1,38 @@
package com.chinaunicom.mall.ebtp.cloud.apollo.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 );
}
}