Commit 5403a855 authored by houg's avatar houg

配置

parent c6a77788
package com.enovate.newretail.eureka;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
@RestController
@RequestMapping(path = "/config")
public class TestController {
@ApolloConfig
private Config config;
@RequestMapping(path = "/get/{key}", method = {RequestMethod.GET, RequestMethod.POST})
public String get(@PathVariable("key") String key) {
return config.getProperty(key, config.getSourceType().name());
}
@RequestMapping(path = "/value", method = {RequestMethod.GET, RequestMethod.POST})
public String value() {
return null;
}
}
eureka.instance.hostname=localhost
eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
\ No newline at end of file
spring: spring:
application: application:
name: eureka-server name: eureka-server
profiles:
active: apollo-env.properties
server: server:
port: 8761 port: 8761
servlet: servlet:
...@@ -8,10 +10,6 @@ server: ...@@ -8,10 +10,6 @@ server:
app: app:
id:evonate-newretail-eureka id:evonate-newretail-eureka
spring:
profiles:
active: apollo-env.properties
#表示是否将自己注册到Eureka Server上,默认为true #表示是否将自己注册到Eureka Server上,默认为true
eureka: eureka:
client: client:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment