1. 增加了apollo 配置中心使用的 demo
2. 调整了apollo starter的pom, 增加了对于mvc starter的依赖
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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
|
@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
@ -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 );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user