Commit 14e584b7 by 张乐 Committed by GitHub

Merge pull request #423 from nobodyiam/build-scripts

adjustment for local one-click start
parents 86371916 83be03ea
...@@ -33,4 +33,15 @@ ...@@ -33,4 +33,15 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>
...@@ -10,6 +10,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder; ...@@ -10,6 +10,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.context.scope.refresh.RefreshScope; import org.springframework.cloud.context.scope.refresh.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import com.ctrip.framework.apollo.portal.PortalApplication;
import com.ctrip.framework.apollo.adminservice.AdminServiceApplication; import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
import com.ctrip.framework.apollo.configservice.ConfigServiceApplication; import com.ctrip.framework.apollo.configservice.ConfigServiceApplication;
...@@ -47,6 +48,16 @@ public class ApolloApplication { ...@@ -47,6 +48,16 @@ public class ApolloApplication {
.sources(RefreshScope.class).run(args); .sources(RefreshScope.class).run(args);
logger.info(adminContext.getId() + " isActive: " + adminContext.isActive()); logger.info(adminContext.getId() + " isActive: " + adminContext.isActive());
} }
/**
* Portal
*/
if (commonContext.getEnvironment().containsProperty("portal")) {
ConfigurableApplicationContext portalContext =
new SpringApplicationBuilder(PortalApplication.class).parent(commonContext)
.sources(RefreshScope.class).run(args);
logger.info(portalContext.getId() + " isActive: " + portalContext.isActive());
}
} }
} }
...@@ -12,7 +12,7 @@ import org.springframework.context.ConfigurableApplicationContext; ...@@ -12,7 +12,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import com.ctrip.framework.apollo.adminservice.AdminServiceApplication; import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
import com.ctrip.framework.apollo.configservice.ConfigServiceApplication; import com.ctrip.framework.apollo.configservice.ConfigServiceApplication;
import com.ctrip.framework.apollo.PortalApplication; import com.ctrip.framework.apollo.portal.PortalApplication;
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
HibernateJpaAutoConfiguration.class}) HibernateJpaAutoConfiguration.class})
......
package com.ctrip.framework.apollo.openapi;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@EnableAutoConfiguration
@Configuration
@ComponentScan(basePackageClasses = PortalOpenApiConfig.class)
public class PortalOpenApiConfig {
}
package com.ctrip.framework.apollo; package com.ctrip.framework.apollo.portal;
import com.ctrip.framework.apollo.common.ApolloCommonConfig; import com.ctrip.framework.apollo.common.ApolloCommonConfig;
import com.ctrip.framework.apollo.openapi.PortalOpenApiConfig;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.system.ApplicationPidFileWriter; import org.springframework.boot.actuate.system.ApplicationPidFileWriter;
...@@ -16,7 +17,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; ...@@ -16,7 +17,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration @Configuration
@EnableAutoConfiguration @EnableAutoConfiguration
@EnableTransactionManagement @EnableTransactionManagement
@ComponentScan(basePackageClasses = {ApolloCommonConfig.class, PortalApplication.class}) @ComponentScan(basePackageClasses = {ApolloCommonConfig.class,
PortalApplication.class, PortalOpenApiConfig.class})
public class PortalApplication { public class PortalApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
......
package com.ctrip.framework.apollo.portal; package com.ctrip.framework.apollo.portal;
import com.ctrip.framework.apollo.PortalApplication;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.boot.test.SpringApplicationConfiguration;
......
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