##### Coverage Report - com.ctrip.framework.apollo.assembly.ApolloApplication

Classes in this File | Line Coverage | Branch Coverage | Complexity
ApolloApplication |
0% | 0/21
0% | 0/6
| 4.0;4

1 |  |
     package com.ctrip.framework.apollo.assembly;
2 |  |
3 |  |
     import org.slf4j.Logger;
4 |  |
     import org.slf4j.LoggerFactory;
5 |  |
     import org.springframework.boot.actuate.system.ApplicationPidFileWriter;
6 |  |
     import org.springframework.boot.autoconfigure.SpringBootApplication;
7 |  |
     import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
8 |  |
     import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
9 |  |
     import org.springframework.boot.builder.SpringApplicationBuilder;
10 |  |
     import org.springframework.cloud.context.scope.refresh.RefreshScope;
11 |  |
     import org.springframework.context.ConfigurableApplicationContext;
12 |  |
13 |  |
     import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
14 |  |
     import com.ctrip.framework.apollo.configservice.ConfigServiceApplication;
15 |  |
     import com.ctrip.framework.apollo.portal.PortalApplication;
16 |  |
17 |  |
     @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
18 |  |
         HibernateJpaAutoConfiguration.class})
19 | 0 |
     public class ApolloApplication {
20 |  |
21 | 0 |
       private static final Logger logger = LoggerFactory.getLogger(ApolloApplication.class);
22 |  |
23 |  |
       public static void main(String[] args) throws Exception {
24 |  |
         /**
25 |  |
          * Common
26 |  |
          */
27 | 0 |
         ConfigurableApplicationContext commonContext =
28 | 0 |
             new SpringApplicationBuilder(ApolloApplication.class).web(false).run(args);
29 | 0 |
         commonContext.addApplicationListener(new ApplicationPidFileWriter());
30 | 0 |
         logger.info(commonContext.getId() + " isActive: " + commonContext.isActive());
31 |  |
32 |  |
         /**
33 |  |
          * ConfigService
34 |  |
          */
35 | 0 |
         if (commonContext.getEnvironment().containsProperty("configservice")) {
36 | 0 |
           ConfigurableApplicationContext configContext =
37 | 0 |
               new SpringApplicationBuilder(ConfigServiceApplication.class).parent(commonContext)
38 | 0 |
                   .sources(RefreshScope.class).run(args);
39 | 0 |
           logger.info(configContext.getId() + " isActive: " + configContext.isActive());
40 |  |
         }
41 |  |
42 |  |
         /**
43 |  |
          * AdminService
44 |  |
          */
45 | 0 |
         if (commonContext.getEnvironment().containsProperty("adminservice")) {
46 | 0 |
           ConfigurableApplicationContext adminContext =
47 | 0 |
               new SpringApplicationBuilder(AdminServiceApplication.class).parent(commonContext)
48 | 0 |
                   .sources(RefreshScope.class).run(args);
49 | 0 |
           logger.info(adminContext.getId() + " isActive: " + adminContext.isActive());
50 |  |
         }
51 |  |
52 |  |
         /**
53 |  |
          * Portal
54 |  |
          *
55 |  |
          * WARNING: Do not start portal at the same pool as configservice, they will conflict on 8080
56 |  |
          */
57 | 0 |
         if (commonContext.getEnvironment().containsProperty("portal")) {
58 | 0 |
           ConfigurableApplicationContext portalContext =
59 | 0 |
               new SpringApplicationBuilder(PortalApplication.class).parent(commonContext).run(args);
60 | 0 |
           logger.info(portalContext.getId() + " isActive: " + portalContext.isActive());
61 |  |
         }
62 | 0 |
       }
63 |  |
64 |  |
     }