diff --git a/apollo-biz/pom.xml b/apollo-biz/pom.xml index 5200d1008bb6fca764b4a5cb3b5a08b733f031f1..0578fd5aa2115ee3b6c5e09faee327e9a1598166 100644 --- a/apollo-biz/pom.xml +++ b/apollo-biz/pom.xml @@ -26,10 +26,5 @@ mysql mysql-connector-java - - com.h2database - h2 - test - diff --git a/apollo-configservice/pom.xml b/apollo-configservice/pom.xml index f3587b9a4816a3ff2590e036715b1ce90f175ef6..46ad6c7d1112dcce5ce068ddf1fc2bc26ecadafb 100644 --- a/apollo-configservice/pom.xml +++ b/apollo-configservice/pom.xml @@ -67,6 +67,11 @@ + + com.h2database + h2 + test + diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/PortalApplication.java b/apollo-portal/src/main/java/com/ctrip/apollo/PortalApplication.java similarity index 95% rename from apollo-portal/src/main/java/com/ctrip/apollo/portal/PortalApplication.java rename to apollo-portal/src/main/java/com/ctrip/apollo/PortalApplication.java index eadcb043e9e283389133cb4fdb8b47287521b39c..e43716bbff1b7393fb155589508d54be1e63e3e6 100644 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/PortalApplication.java +++ b/apollo-portal/src/main/java/com/ctrip/apollo/PortalApplication.java @@ -1,4 +1,4 @@ -package com.ctrip.apollo.portal; +package com.ctrip.apollo; import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.system.ApplicationPidFileWriter; diff --git a/apollo-portal/src/main/java/com/ctrip/apollo/portal/api/API.java b/apollo-portal/src/main/java/com/ctrip/apollo/portal/api/API.java index 7619d95620dc5a78a0671efc274c6db0b1f8a334..d6afe4a12f86093b7247b9a0b9ced209fed82cb4 100644 --- a/apollo-portal/src/main/java/com/ctrip/apollo/portal/api/API.java +++ b/apollo-portal/src/main/java/com/ctrip/apollo/portal/api/API.java @@ -1,20 +1,30 @@ package com.ctrip.apollo.portal.api; -import com.ctrip.apollo.core.enums.Env; -import com.ctrip.apollo.core.exception.ServiceException; -import com.ctrip.apollo.portal.service.ServiceLocator; +import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.client.RestTemplate; +import com.ctrip.apollo.common.auth.RestTemplateFactory; +import com.ctrip.apollo.core.enums.Env; +import com.ctrip.apollo.core.exception.ServiceException; +import com.ctrip.apollo.portal.service.ServiceLocator; + public class API { @Autowired protected ServiceLocator serviceLocator; @Autowired + private RestTemplateFactory restTemplateFactory; + protected RestTemplate restTemplate; + @PostConstruct + private void postConstruct() { + restTemplate = restTemplateFactory.getObject(); + } + public String getAdminServiceHost(Env env) { // 本地测试用 // return "http://localhost:8090"; @@ -25,5 +35,5 @@ public class API { } return ""; } - + } diff --git a/apollo-portal/src/main/resources/application.yml b/apollo-portal/src/main/resources/application.yml index 56b4f5e9ff6916a6a2642e02a5a5cf27b4781a87..34c93a61b537ba61b4dcb853562256194096aa3c 100644 --- a/apollo-portal/src/main/resources/application.yml +++ b/apollo-portal/src/main/resources/application.yml @@ -15,4 +15,4 @@ ctrip: apollo: portal: - env: dev + env: local diff --git a/apollo-portal/src/test/java/com/ctrip/apollo/portal/AbstractPortalTest.java b/apollo-portal/src/test/java/com/ctrip/apollo/portal/AbstractPortalTest.java index 3f11295e202bcbf2115b94b00f0c59df2715c074..cd3e98a71371d5306b054e3837033b89e1528736 100644 --- a/apollo-portal/src/test/java/com/ctrip/apollo/portal/AbstractPortalTest.java +++ b/apollo-portal/src/test/java/com/ctrip/apollo/portal/AbstractPortalTest.java @@ -4,6 +4,8 @@ import org.junit.runner.RunWith; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import com.ctrip.apollo.PortalApplication; + @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = PortalApplication.class) public abstract class AbstractPortalTest {