Commit 883ded6b authored by houg's avatar houg

apollo

parent 05cf1163
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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"> 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> <modelVersion>4.0.0</modelVersion>
...@@ -16,7 +15,7 @@ ...@@ -16,7 +15,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version> <version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath /> <!-- lookup parent from repository -->
</parent> </parent>
<properties> <properties>
...@@ -40,6 +39,20 @@ ...@@ -40,6 +39,20 @@
<artifactId>spring-boot-starter-security</artifactId> <artifactId>spring-boot-starter-security</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
......
...@@ -7,11 +7,14 @@ import org.springframework.context.annotation.Configuration; ...@@ -7,11 +7,14 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
/** /**
* @author Ryan * @author Ryan
*/ */
@EnableEurekaServer @EnableEurekaServer
@SpringBootApplication @SpringBootApplication
@EnableApolloConfig
public class EurekaServerApplication { public class EurekaServerApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
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());
}
}
dev.meta=http://132.232.68.227:8080
fat.meta=http://172.21.28.19:8080
uat.meta=http://192.168.1.38:8082
pro.meta=http://192.168.1.38:8083
\ No newline at end of file
spring.application.name=eureka-server spring.application.name=eureka-server
server.port=8761 server.port=8761
app.id=evonate-newretail-eureka
apollo.meta=http://192.168.1.38:8080
#spring.profiles.active = apollo-env.properties
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