diff --git a/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java b/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java index d0e62117dd9e36b455036556e72dd4c64f5d71a5..a392e09726d5e56869885977371a0da4f790d47a 100644 --- a/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java +++ b/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java @@ -48,17 +48,6 @@ public class ApolloApplication { .sources(RefreshScope.class).run(args); logger.info(adminContext.getId() + " isActive: " + adminContext.isActive()); } - - /** - * Portal - * - * WARNING: Do not start portal at the same pool as configservice, they will conflict on 8080 - */ - if (commonContext.getEnvironment().containsProperty("portal")) { - ConfigurableApplicationContext portalContext = - new SpringApplicationBuilder(PortalApplication.class).parent(commonContext).run(args); - logger.info(portalContext.getId() + " isActive: " + portalContext.isActive()); - } } } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalApplication.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalApplication.java index c2ee6c2541aa9dfa30e62b1cf9b128e6f3b84708..30d08f0dc4e8738087da4e15fb9176df8b7f3e25 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalApplication.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalApplication.java @@ -17,7 +17,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableAutoConfiguration @EnableTransactionManagement -@PropertySource(value = {"classpath:portal.properties"}) @ComponentScan(basePackageClasses = {ApolloCommonConfig.class, PortalApplication.class}) public class PortalApplication { diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalSettings.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalSettings.java index 8ac0717abacf963995263f84412197737c01d5e2..75a1c5fddd7459616fa87f11b4457e9071829e03 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalSettings.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalSettings.java @@ -35,7 +35,6 @@ public class PortalSettings { private static final int HEALTH_CHECK_INTERVAL = 5000; - @Value("#{'${apollo.portal.envs}'.split(',')}") private List allStrEnvs; @Autowired diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ServerConfigService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ServerConfigService.java index 30f8e0da14fdb8e3d8c3440dc0d9ab3030e97aa6..cecba8db381ff565f9219249e7643f6037c1f5fe 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ServerConfigService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ServerConfigService.java @@ -4,6 +4,7 @@ import com.ctrip.framework.apollo.portal.entity.po.ServerConfig; import com.ctrip.framework.apollo.portal.repository.ServerConfigRepository; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; /** @@ -14,7 +15,14 @@ public class ServerConfigService { @Autowired private ServerConfigRepository serverConfigRepository; + @Autowired + private Environment environment; + public String getValue(String key) { + if (environment.containsProperty(key)) { + return environment.getProperty(key); + } + ServerConfig serverConfig = serverConfigRepository.findByKey(key); return serverConfig == null ? null : serverConfig.getValue(); diff --git a/apollo-portal/src/main/resources/portal.properties b/apollo-portal/src/main/resources/portal.properties deleted file mode 100644 index 454f44d9bdcec6205dc134433715ffe8893755a7..0000000000000000000000000000000000000000 --- a/apollo-portal/src/main/resources/portal.properties +++ /dev/null @@ -1,7 +0,0 @@ -spring.application.name= apollo-portal -apollo.portal.envs= fat,uat,pro -ctrip.appid= 100003173 -server.port= 8070 -logging.file= /opt/logs/100003173/apollo-portal.log - -server.context_parameters.appid = ${ctrip.appid}