Browse Source

upgrade spring boot to 2.0.5 and spring cloud to Finchley.SR1

nobodyiam 6 years ago
parent
commit
55a0e1b8ab
88 changed files with 277 additions and 348 deletions
  1. 3 5
      apollo-adminservice/pom.xml
  2. 1 1
      apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/AdminServiceHealthIndicator.java
  3. 1 1
      apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/InstanceConfigController.java
  4. 1 0
      apollo-adminservice/src/main/resources/adminservice.properties
  5. 2 8
      apollo-adminservice/src/main/resources/bootstrap.yml
  6. 1 1
      apollo-adminservice/src/main/scripts/startup.sh
  7. 6 7
      apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java
  8. 3 3
      apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java
  9. 2 2
      apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java
  10. 4 4
      apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/InstanceConfigControllerTest.java
  11. 6 6
      apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
  12. 1 1
      apollo-adminservice/src/test/resources/application.properties
  13. 3 7
      apollo-adminservice/src/test/resources/bootstrap.yml
  14. 2 1
      apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java
  15. 2 1
      apollo-assembly/src/test/java/com/ctrip/framework/apollo/assembly/LocalApolloApplication.java
  16. 1 1
      apollo-assembly/src/test/resources/application.properties
  17. 1 1
      apollo-biz/pom.xml
  18. 2 1
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Instance.java
  19. 2 1
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/InstanceConfig.java
  20. 2 1
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ReleaseMessage.java
  21. 2 2
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/DatabaseMessageSender.java
  22. 1 1
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java
  23. 2 2
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java
  24. 2 2
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/InstanceService.java
  25. 3 3
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
  26. 1 1
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java
  27. 3 3
      apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java
  28. 3 4
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/AbstractIntegrationTest.java
  29. 1 1
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/config/BizConfigTest.java
  30. 1 1
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/repository/AppRepositoryTest.java
  31. 4 4
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/InstanceServiceTest.java
  32. 1 1
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
  33. 5 5
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceServiceIntegrationTest.java
  34. 2 2
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceServiceTest.java
  35. 1 1
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseCreationTest.java
  36. 6 5
      apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java
  37. 1 1
      apollo-biz/src/test/resources/application.properties
  38. 0 1
      apollo-client/src/test/java/com/ctrip/framework/apollo/internals/PropertiesConfigFileTest.java
  39. 0 3
      apollo-client/src/test/java/com/ctrip/framework/apollo/internals/RemoteConfigLongPollServiceTest.java
  40. 7 7
      apollo-client/src/test/java/com/ctrip/framework/apollo/spring/BootstrapConfigTest.java
  41. 0 11
      apollo-common/pom.xml
  42. 1 1
      apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CharacterEncodingFilterConfiguration.java
  43. 1 1
      apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/HttpMessageConverterConfiguration.java
  44. 8 8
      apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/WebMvcConfig.java
  45. 0 50
      apollo-common/src/main/java/com/ctrip/framework/apollo/common/customize/TomcatContainerCustomizer.java
  46. 2 1
      apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/BaseEntity.java
  47. 6 7
      apollo-common/src/main/resources/application.properties
  48. 8 0
      apollo-common/src/main/resources/banner.txt
  49. 3 5
      apollo-configservice/pom.xml
  50. 1 1
      apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServiceHealthIndicator.java
  51. 1 1
      apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ServletInitializer.java
  52. 1 1
      apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/AppNamespaceServiceWithCache.java
  53. 2 6
      apollo-configservice/src/main/resources/bootstrap.yml
  54. 2 1
      apollo-configservice/src/main/resources/configservice.properties
  55. 1 1
      apollo-configservice/src/main/scripts/startup.sh
  56. 6 7
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/AbstractBaseIntegrationTest.java
  57. 20 20
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/ConfigControllerIntegrationTest.java
  58. 15 15
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/ConfigFileControllerIntegrationTest.java
  59. 9 9
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/NotificationControllerIntegrationTest.java
  60. 17 17
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/NotificationControllerV2IntegrationTest.java
  61. 3 3
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/AppNamespaceServiceWithCacheTest.java
  62. 1 1
      apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/wrapper/CaseInsensitiveMapWrapperTest.java
  63. 1 1
      apollo-configservice/src/test/resources/application.properties
  64. 2 7
      apollo-configservice/src/test/resources/bootstrap.yml
  65. 2 2
      apollo-mockserver/src/test/java/com/ctrip/framework/apollo/mockserver/ApolloMockServerSpringIntegrationTest.java
  66. 2 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerAudit.java
  67. 2 2
      apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java
  68. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/AdminServiceAddressLocator.java
  69. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.java
  70. 2 2
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RetryableRestTemplate.java
  71. 2 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/UserPO.java
  72. 2 2
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/FavoriteService.java
  73. 4 5
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
  74. 1 1
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthFilterConfiguration.java
  75. 2 2
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/WebContextConfiguration.java
  76. 4 4
      apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/defaultimpl/DefaultRolePermissionService.java
  77. 3 6
      apollo-portal/src/main/resources/application.yml
  78. 1 1
      apollo-portal/src/main/scripts/startup.sh
  79. 1 1
      apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/filter/ConsumerAuthenticationFilterTest.java
  80. 4 3
      apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/service/ConsumerServiceTest.java
  81. 1 1
      apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/util/ConsumerAuditUtilTest.java
  82. 1 1
      apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/util/ConsumerAuthUtilTest.java
  83. 5 6
      apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/AbstractIntegrationTest.java
  84. 8 8
      apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/FavoriteServiceTest.java
  85. 3 3
      apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/spi/defaultImpl/RolePermissionServiceTest.java
  86. 1 1
      apollo-portal/src/test/resources/application.properties
  87. 0 7
      apollo-portal/src/test/resources/application.yml
  88. 21 8
      pom.xml

+ 3 - 5
apollo-adminservice/pom.xml

@@ -22,17 +22,15 @@
 		<!-- end of apollo -->
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>
-			<artifactId>spring-cloud-starter-eureka-server</artifactId>
+			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
 			<scope>test</scope>
 			<exclusions>
 				<exclusion>
-					<artifactId>
-                        spring-cloud-starter-archaius
-                    </artifactId>
+					<artifactId>spring-cloud-starter-netflix-archaius</artifactId>
 					<groupId>org.springframework.cloud</groupId>
 				</exclusion>
 				<exclusion>
-					<artifactId>spring-cloud-starter-ribbon</artifactId>
+					<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
 					<groupId>org.springframework.cloud</groupId>
 				</exclusion>
 				<exclusion>

+ 1 - 1
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/AdminServiceHealthIndicator.java

@@ -24,7 +24,7 @@ public class AdminServiceHealthIndicator implements HealthIndicator {
   }
 
   private int check() {
-    PageRequest pageable = new PageRequest(0, 1);
+    PageRequest pageable = PageRequest.of(0, 1);
     appService.findAll(pageable);
     return 0;
   }

+ 1 - 1
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/InstanceConfigController.java

@@ -183,7 +183,7 @@ public class InstanceConfigController {
                                           @RequestParam("clusterName") String clusterName,
                                           @RequestParam("namespaceName") String namespaceName) {
     Page<Instance> instances = instanceService.findInstancesByNamespace(appId, clusterName,
-        namespaceName, new PageRequest(0, 1));
+        namespaceName, PageRequest.of(0, 1));
     return instances.getTotalElements();
   }
 }

+ 1 - 0
apollo-adminservice/src/main/resources/adminservice.properties

@@ -3,3 +3,4 @@ spring.application.name= apollo-adminservice
 ctrip.appid= 100003172
 server.port= 8090
 logging.file= /opt/logs/100003172/apollo-adminservice.log
+spring.jmx.default-domain = apollo-adminservice

+ 2 - 8
apollo-adminservice/src/main/resources/bootstrap.yml

@@ -2,6 +2,8 @@ eureka:
   instance:
     hostname: ${hostname:localhost}
     preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
   client:
     serviceUrl:
       defaultZone: http://${eureka.instance.hostname}:8080/eureka/
@@ -9,15 +11,7 @@ eureka:
       enabled: true
     eurekaServiceUrlPollIntervalSeconds: 60
 
-endpoints:
-  health:
-    sensitive: false
-
-
-
 management:
-  security:
-    enabled: false
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 1 - 1
apollo-adminservice/src/main/scripts/startup.sh

@@ -99,7 +99,7 @@ declare -i max_counter=48 # 48*5=240s
 declare -i total_time=0
 
 printf "Waiting for server startup"
-until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "Coyote")" != "" ]];
+until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
 do
     printf "."
     counter+=1

+ 6 - 7
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java

@@ -5,10 +5,10 @@ import com.ctrip.framework.apollo.AdminServiceTestConfiguration;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
-import org.springframework.boot.test.SpringApplicationConfiguration;
-import org.springframework.boot.test.TestRestTemplate;
-import org.springframework.boot.test.WebIntegrationTest;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.web.client.DefaultResponseErrorHandler;
 import org.springframework.web.client.RestTemplate;
@@ -16,14 +16,13 @@ import org.springframework.web.client.RestTemplate;
 import javax.annotation.PostConstruct;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = AdminServiceTestConfiguration.class)
-@WebIntegrationTest(randomPort = true)
+@SpringBootTest(classes = AdminServiceTestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT)
 public abstract class AbstractControllerTest {
 
   @Autowired
   private HttpMessageConverters httpMessageConverters;
   
-  RestTemplate restTemplate = new TestRestTemplate();
+  protected RestTemplate restTemplate = (new TestRestTemplate()).getRestTemplate();
 
   @PostConstruct
   private void postConstruct() {

+ 3 - 3
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java

@@ -53,7 +53,7 @@ public class AppControllerTest extends AbstractControllerTest {
     Assert.assertEquals(dto.getAppId(), result.getAppId());
     Assert.assertTrue(result.getId() > 0);
 
-    App savedApp = appRepository.findOne(result.getId());
+    App savedApp = appRepository.findById(result.getId()).orElse(null);
     Assert.assertEquals(dto.getAppId(), savedApp.getAppId());
     Assert.assertNotNull(savedApp.getDataChangeCreatedTime());
   }
@@ -69,7 +69,7 @@ public class AppControllerTest extends AbstractControllerTest {
     Assert.assertEquals(dto.getAppId(), first.getAppId());
     Assert.assertTrue(first.getId() > 0);
 
-    App savedApp = appRepository.findOne(first.getId());
+    App savedApp = appRepository.findById(first.getId()).orElse(null);
     Assert.assertEquals(dto.getAppId(), savedApp.getAppId());
     Assert.assertNotNull(savedApp.getDataChangeCreatedTime());
 
@@ -108,7 +108,7 @@ public class AppControllerTest extends AbstractControllerTest {
 
     restTemplate.delete("http://localhost:{port}/apps/{appId}?operator={operator}", port, app.getAppId(), "test");
 
-    App deletedApp = appRepository.findOne(app.getId());
+    App deletedApp = appRepository.findById(app.getId()).orElse(null);
     Assert.assertNull(deletedApp);
   }
 

+ 2 - 2
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java

@@ -56,7 +56,7 @@ public class ControllerExceptionTest {
   @Test
   public void testFindEmpty() {
     when(appService.findAll(any(Pageable.class))).thenReturn(new ArrayList<App>());
-    Pageable pageable = new PageRequest(0, 10);
+    Pageable pageable = PageRequest.of(0, 10);
     List<AppDTO> appDTOs = appController.find(null, pageable);
     Assert.assertNotNull(appDTOs);
     Assert.assertEquals(0, appDTOs.size());
@@ -68,7 +68,7 @@ public class ControllerExceptionTest {
 
   @Test
   public void testFindByName() {
-    Pageable pageable = new PageRequest(0, 10);
+    Pageable pageable = PageRequest.of(0, 10);
     List<AppDTO> appDTOs = appController.find("unexist", pageable);
     Assert.assertNotNull(appDTOs);
     Assert.assertEquals(0, appDTOs.size());

+ 4 - 4
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/InstanceConfigControllerTest.java

@@ -20,6 +20,7 @@ import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.test.util.ReflectionTestUtils;
 
@@ -47,7 +48,6 @@ public class InstanceConfigControllerTest {
   @Mock
   private InstanceService instanceService;
 
-  @Mock
   private Pageable pageable;
 
   @Before
@@ -55,6 +55,8 @@ public class InstanceConfigControllerTest {
     instanceConfigController = new InstanceConfigController();
     ReflectionTestUtils.setField(instanceConfigController, "releaseService", releaseService);
     ReflectionTestUtils.setField(instanceConfigController, "instanceService", instanceService);
+
+    pageable = PageRequest.of(0, 2);
   }
 
   @Test
@@ -230,7 +232,6 @@ public class InstanceConfigControllerTest {
     String someIp = "someIp";
     long someInstanceId = 1;
     long anotherInstanceId = 2;
-    Pageable pageable = mock(Pageable.class);
 
     Instance someInstance = assembleInstance(someInstanceId, someAppId, someClusterName,
         someNamespaceName, someIp);
@@ -270,7 +271,6 @@ public class InstanceConfigControllerTest {
     String someIp = "someIp";
     long someInstanceId = 1;
     long anotherInstanceId = 2;
-    Pageable pageable = mock(Pageable.class);
 
     Instance someInstance = assembleInstance(someInstanceId, someAppId, someClusterName,
         someNamespaceName, someIp);
@@ -352,4 +352,4 @@ public class InstanceConfigControllerTest {
     instanceConfig.setReleaseDeliveryTime(releaseDeliveryTime);
     return instanceConfig;
   }
-}
+}

+ 6 - 6
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java

@@ -11,7 +11,7 @@ import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
 import org.junit.Assert;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.TestRestTemplate;
+import org.springframework.boot.test.web.client.TestRestTemplate;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.test.context.jdbc.Sql;
@@ -47,7 +47,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
 
     ItemChangeSets itemSet = new ItemChangeSets();
     itemSet.setDataChangeLastModifiedBy("created");
-    RestTemplate createdTemplate = new TestRestTemplate();
+    RestTemplate createdTemplate = (new TestRestTemplate()).getRestTemplate();
     createdTemplate.setMessageConverters(restTemplate.getMessageConverters());
     
     int createdSize = 3;
@@ -96,7 +96,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
 
     ItemChangeSets createChangeSet = new ItemChangeSets();
     createChangeSet.setDataChangeLastModifiedBy("created");
-    RestTemplate createdRestTemplate = new TestRestTemplate();
+    RestTemplate createdRestTemplate = (new TestRestTemplate()).getRestTemplate();
     createdRestTemplate.setMessageConverters(restTemplate.getMessageConverters());
     
     int createdSize = 3;
@@ -123,7 +123,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
     ItemChangeSets updateChangeSet = new ItemChangeSets();
     updateChangeSet.setDataChangeLastModifiedBy("updated");
 
-    RestTemplate updatedRestTemplate = new TestRestTemplate();
+    RestTemplate updatedRestTemplate = (new TestRestTemplate()).getRestTemplate();
     updatedRestTemplate.setMessageConverters(restTemplate.getMessageConverters());
     
     int updatedSize = 2;
@@ -170,7 +170,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
 
     ItemChangeSets createChangeSet = new ItemChangeSets();
     createChangeSet.setDataChangeLastModifiedBy("created");
-    RestTemplate createdTemplate = new TestRestTemplate();
+    RestTemplate createdTemplate = (new TestRestTemplate()).getRestTemplate();
     createdTemplate.setMessageConverters(restTemplate.getMessageConverters());
     
     int createdSize = 3;
@@ -196,7 +196,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
 
     ItemChangeSets deleteChangeSet = new ItemChangeSets();
     deleteChangeSet.setDataChangeLastModifiedBy("deleted");
-    RestTemplate deletedTemplate = new TestRestTemplate();
+    RestTemplate deletedTemplate = (new TestRestTemplate()).getRestTemplate();
     deletedTemplate.setMessageConverters(restTemplate.getMessageConverters());
     
     int deletedSize = 1;

+ 1 - 1
apollo-adminservice/src/test/resources/application.properties

@@ -1,5 +1,5 @@
 spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1
-spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
+spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true

+ 3 - 7
apollo-adminservice/src/test/resources/bootstrap.yml

@@ -1,20 +1,16 @@
 eureka:
   instance:
     hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
   client:
     serviceUrl:
       defaultZone: http://${eureka.instance.hostname}:8090/eureka/
     healthcheck:
       enabled: true
       
-
-endpoints:
-  health:
-    sensitive: false
-
 management:
-  security:
-    enabled: false
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 2 - 1
apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java

@@ -6,6 +6,7 @@ import com.ctrip.framework.apollo.portal.PortalApplication;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.boot.WebApplicationType;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
@@ -24,7 +25,7 @@ public class ApolloApplication {
      * Common
      */
     ConfigurableApplicationContext commonContext =
-        new SpringApplicationBuilder(ApolloApplication.class).web(false).run(args);
+        new SpringApplicationBuilder(ApolloApplication.class).web(WebApplicationType.NONE).run(args);
     logger.info(commonContext.getId() + " isActive: " + commonContext.isActive());
 
     /**

+ 2 - 1
apollo-assembly/src/test/java/com/ctrip/framework/apollo/assembly/LocalApolloApplication.java

@@ -6,6 +6,7 @@ import com.ctrip.framework.apollo.portal.PortalApplication;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.boot.WebApplicationType;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
@@ -24,7 +25,7 @@ public class LocalApolloApplication {
      * Common
      */
     ConfigurableApplicationContext commonContext =
-        new SpringApplicationBuilder(ApolloApplication.class).web(false).run(args);
+        new SpringApplicationBuilder(ApolloApplication.class).web(WebApplicationType.NONE).run(args);
     logger.info(commonContext.getId() + " isActive: " + commonContext.isActive());
 
     /**

+ 1 - 1
apollo-assembly/src/test/resources/application.properties

@@ -1,5 +1,5 @@
 spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE
-spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
+spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true

+ 1 - 1
apollo-biz/pom.xml

@@ -21,7 +21,7 @@
 		<!-- eureka -->
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>
-			<artifactId>spring-cloud-starter-eureka</artifactId>
+			<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
 		</dependency>
 		<!-- end of eureka -->
 		<dependency>

+ 2 - 1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Instance.java

@@ -7,6 +7,7 @@ import java.util.Date;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.PrePersist;
 import javax.persistence.Table;
@@ -18,7 +19,7 @@ import javax.persistence.Table;
 @Table(name = "Instance")
 public class Instance {
   @Id
-  @GeneratedValue
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "Id")
   private long id;
 

+ 2 - 1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/InstanceConfig.java

@@ -7,6 +7,7 @@ import java.util.Date;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.PrePersist;
 import javax.persistence.PreUpdate;
@@ -19,7 +20,7 @@ import javax.persistence.Table;
 @Table(name = "InstanceConfig")
 public class InstanceConfig {
   @Id
-  @GeneratedValue
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "Id")
   private long id;
 

+ 2 - 1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ReleaseMessage.java

@@ -7,6 +7,7 @@ import java.util.Date;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.PrePersist;
 import javax.persistence.Table;
@@ -18,7 +19,7 @@ import javax.persistence.Table;
 @Table(name = "ReleaseMessage")
 public class ReleaseMessage {
   @Id
-  @GeneratedValue
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "Id")
   private long id;
 

+ 2 - 2
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/DatabaseMessageSender.java

@@ -88,7 +88,7 @@ public class DatabaseMessageSender implements MessageSender {
   private void cleanMessage(Long id) {
     boolean hasMore = true;
     //double check in case the release message is rolled back
-    ReleaseMessage releaseMessage = releaseMessageRepository.findOne(id);
+    ReleaseMessage releaseMessage = releaseMessageRepository.findById(id).orElse(null);
     if (releaseMessage == null) {
       return;
     }
@@ -96,7 +96,7 @@ public class DatabaseMessageSender implements MessageSender {
       List<ReleaseMessage> messages = releaseMessageRepository.findFirst100ByMessageAndIdLessThanOrderByIdAsc(
           releaseMessage.getMessage(), releaseMessage.getId());
 
-      releaseMessageRepository.delete(messages);
+      releaseMessageRepository.deleteAll(messages);
       hasMore = messages.size() == 100;
 
       messages.forEach(toRemove -> Tracer.logEvent(

+ 1 - 1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java

@@ -31,7 +31,7 @@ public class AppService {
   
   @Transactional
   public void delete(long id, String operator) {
-    App app = appRepository.findOne(id);
+    App app = appRepository.findById(id).orElse(null);
     if (app == null) {
       return;
     }

+ 2 - 2
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java

@@ -40,7 +40,7 @@ public class ClusterService {
   }
 
   public Cluster findOne(long clusterId) {
-    return clusterRepository.findOne(clusterId);
+    return clusterRepository.findById(clusterId).orElse(null);
   }
 
   public List<Cluster> findParentClusters(String appId) {
@@ -85,7 +85,7 @@ public class ClusterService {
 
   @Transactional
   public void delete(long id, String operator) {
-    Cluster cluster = clusterRepository.findOne(id);
+    Cluster cluster = clusterRepository.findById(id).orElse(null);
     if (cluster == null) {
       throw new BadRequestException("cluster not exist");
     }

+ 2 - 2
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/InstanceService.java

@@ -41,7 +41,7 @@ public class InstanceService {
   }
 
   public List<Instance> findInstancesByIds(Set<Long> instanceIds) {
-    Iterable<Instance> instances = instanceRepository.findAll(instanceIds);
+    Iterable<Instance> instances = instanceRepository.findAllById(instanceIds);
     if (instances == null) {
       return Collections.emptyList();
     }
@@ -159,7 +159,7 @@ public class InstanceService {
 
   @Transactional
   public InstanceConfig updateInstanceConfig(InstanceConfig instanceConfig) {
-    InstanceConfig existedInstanceConfig = instanceConfigRepository.findOne(instanceConfig.getId());
+    InstanceConfig existedInstanceConfig = instanceConfigRepository.findById(instanceConfig.getId()).orElse(null);
     Preconditions.checkArgument(existedInstanceConfig != null, String.format(
         "Instance config %d doesn't exist", instanceConfig.getId()));
 

+ 3 - 3
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java

@@ -38,7 +38,7 @@ public class ItemService {
 
   @Transactional
   public Item delete(long id, String operator) {
-    Item item = itemRepository.findOne(id);
+    Item item = itemRepository.findById(id).orElse(null);
     if (item == null) {
       throw new IllegalArgumentException("item not exist. ID:" + id);
     }
@@ -81,7 +81,7 @@ public class ItemService {
   }
 
   public Item findOne(long itemId) {
-    Item item = itemRepository.findOne(itemId);
+    Item item = itemRepository.findById(itemId).orElse(null);
     return item;
   }
 
@@ -147,7 +147,7 @@ public class ItemService {
   @Transactional
   public Item update(Item item) {
     checkItemValueLength(item.getNamespaceId(), item.getValue());
-    Item managedItem = itemRepository.findOne(item.getId());
+    Item managedItem = itemRepository.findById(item.getId()).orElse(null);
     BeanUtils.copyEntityProperties(item, managedItem);
     managedItem = itemRepository.save(managedItem);
 

+ 1 - 1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java

@@ -67,7 +67,7 @@ public class NamespaceService {
 
 
   public Namespace findOne(Long namespaceId) {
-    return namespaceRepository.findOne(namespaceId);
+    return namespaceRepository.findById(namespaceId).orElse(null);
   }
 
   public Namespace findOne(String appId, String clusterName, String namespaceName) {

+ 3 - 3
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java

@@ -64,7 +64,7 @@ public class ReleaseService {
   private ItemSetService itemSetService;
 
   public Release findOne(long releaseId) {
-    return releaseRepository.findOne(releaseId);
+    return releaseRepository.findById(releaseId).orElse(null);
   }
 
 
@@ -73,7 +73,7 @@ public class ReleaseService {
   }
 
   public List<Release> findByReleaseIds(Set<Long> releaseIds) {
-    Iterable<Release> releases = releaseRepository.findAll(releaseIds);
+    Iterable<Release> releases = releaseRepository.findAllById(releaseIds);
     if (releases == null) {
       return Collections.emptyList();
     }
@@ -397,7 +397,7 @@ public class ReleaseService {
     String clusterName = release.getClusterName();
     String namespaceName = release.getNamespaceName();
 
-    PageRequest page = new PageRequest(0, 2);
+    PageRequest page = PageRequest.of(0, 2);
     List<Release> twoLatestActiveReleases = findActiveReleases(appId, clusterName, namespaceName, page);
     if (twoLatestActiveReleases == null || twoLatestActiveReleases.size() < 2) {
       throw new BadRequestException(String.format(

+ 3 - 4
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/AbstractIntegrationTest.java

@@ -1,8 +1,8 @@
 package com.ctrip.framework.apollo.biz;
 
 import org.junit.runner.RunWith;
-import org.springframework.boot.test.SpringApplicationConfiguration;
-import org.springframework.boot.test.WebIntegrationTest;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
 import org.springframework.test.annotation.Rollback;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.transaction.annotation.Transactional;
@@ -10,8 +10,7 @@ import org.springframework.transaction.annotation.Transactional;
 @RunWith(SpringJUnit4ClassRunner.class)
 @Rollback
 @Transactional
-@WebIntegrationTest(randomPort = true)
-@SpringApplicationConfiguration(classes = BizTestConfiguration.class)
+@SpringBootTest(classes = BizTestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT)
 public abstract class AbstractIntegrationTest {
 
 }

+ 1 - 1
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/config/BizConfigTest.java

@@ -77,4 +77,4 @@ public class BizConfigTest {
     assertEquals(someValidValue, bizConfig.checkInt(someValidValue, Integer.MIN_VALUE, Integer.MAX_VALUE,
         someDefaultValue));
   }
-}
+}

+ 1 - 1
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/repository/AppRepositoryTest.java

@@ -51,7 +51,7 @@ public class AppRepositoryTest extends AbstractIntegrationTest{
 
     Assert.assertEquals(1, appRepository.count());
 
-    appRepository.delete(app.getId());
+    appRepository.deleteById(app.getId());
 
     Assert.assertEquals(0, appRepository.count());
   }

+ 4 - 4
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/InstanceServiceTest.java

@@ -119,7 +119,7 @@ public class InstanceServiceTest extends AbstractIntegrationTest {
     String someConfigClusterName = "someConfigClusterName";
     String someConfigNamespaceName = "someConfigNamespaceName";
     Date someValidDate = new Date();
-    Pageable pageable = new PageRequest(0, 10);
+    Pageable pageable = PageRequest.of(0, 10);
     String someReleaseKey = "someReleaseKey";
 
     Calendar calendar = Calendar.getInstance();
@@ -165,7 +165,7 @@ public class InstanceServiceTest extends AbstractIntegrationTest {
         someConfigNamespaceName, someReleaseKey, someValidDate);
 
     Page<Instance> result = instanceService.findInstancesByNamespace(someConfigAppId,
-        someConfigClusterName, someConfigNamespaceName, new PageRequest(0, 10));
+        someConfigClusterName, someConfigNamespaceName, PageRequest.of(0, 10));
 
     assertEquals(Lists.newArrayList(someInstance, anotherInstance), result.getContent());
   }
@@ -197,9 +197,9 @@ public class InstanceServiceTest extends AbstractIntegrationTest {
         someConfigNamespaceName, someReleaseKey, someValidDate);
 
     Page<Instance> result = instanceService.findInstancesByNamespaceAndInstanceAppId(someAppId,
-        someConfigAppId, someConfigClusterName, someConfigNamespaceName, new PageRequest(0, 10));
+        someConfigAppId, someConfigClusterName, someConfigNamespaceName, PageRequest.of(0, 10));
     Page<Instance> anotherResult = instanceService.findInstancesByNamespaceAndInstanceAppId(anotherAppId,
-        someConfigAppId, someConfigClusterName, someConfigNamespaceName, new PageRequest(0, 10));
+        someConfigAppId, someConfigClusterName, someConfigNamespaceName, PageRequest.of(0, 10));
 
     assertEquals(Lists.newArrayList(someInstance), result.getContent());
     assertEquals(Lists.newArrayList(anotherInstance), anotherResult.getContent());

+ 1 - 1
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java

@@ -28,7 +28,7 @@ public class NamespaceBranchServiceTest extends AbstractIntegrationTest {
   private String testNamespace = "application";
   private String testBranchName = "child-cluster";
   private String operator = "apollo";
-  private Pageable pageable = new PageRequest(0, 10);
+  private Pageable pageable = PageRequest.of(0, 10);
 
   @Test
   @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)

+ 5 - 5
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceServiceIntegrationTest.java

@@ -64,19 +64,19 @@ public class NamespaceServiceIntegrationTest extends AbstractIntegrationTest {
     namespaceService.deleteNamespace(namespace, testUser);
 
     List<Item> items = itemService.findItemsWithoutOrdered(testApp, testCluster, testPrivateNamespace);
-    List<Commit> commits = commitService.find(testApp, testCluster, testPrivateNamespace, new PageRequest(0, 10));
+    List<Commit> commits = commitService.find(testApp, testCluster, testPrivateNamespace, PageRequest.of(0, 10));
     AppNamespace appNamespace = appNamespaceService.findOne(testApp, testPrivateNamespace);
     List<Cluster> childClusters = clusterService.findChildClusters(testApp, testCluster);
-    InstanceConfig instanceConfig = instanceConfigRepository.findOne(1L);
+    InstanceConfig instanceConfig = instanceConfigRepository.findById(1L).orElse(null);
     List<Release> parentNamespaceReleases = releaseService.findActiveReleases(testApp, testCluster,
                                                                               testPrivateNamespace,
-                                                                              new PageRequest(0, 10));
+                                                                              PageRequest.of(0, 10));
     List<Release> childNamespaceReleases = releaseService.findActiveReleases(testApp, testChildCluster,
                                                                              testPrivateNamespace,
-                                                                             new PageRequest(0, 10));
+                                                                             PageRequest.of(0, 10));
     Page<ReleaseHistory> releaseHistories =
         releaseHistoryService
-            .findReleaseHistoriesByNamespace(testApp, testCluster, testPrivateNamespace, new PageRequest(0, 10));
+            .findReleaseHistoriesByNamespace(testApp, testCluster, testPrivateNamespace, PageRequest.of(0, 10));
 
     assertEquals(0, items.size());
     assertEquals(0, commits.size());

+ 2 - 2
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceServiceTest.java

@@ -38,7 +38,7 @@ public class NamespaceServiceTest extends AbstractUnitTest {
 
   @Test(expected = BadRequestException.class)
   public void testFindPublicAppNamespaceWithWrongNamespace() {
-    Pageable page = new PageRequest(0, 10);
+    Pageable page = PageRequest.of(0, 10);
 
     when(appNamespaceService.findPublicNamespaceByName(testPublicAppNamespace)).thenReturn(null);
 
@@ -59,7 +59,7 @@ public class NamespaceServiceTest extends AbstractUnitTest {
         MockBeanFactory.mockNamespace("app2", ConfigConsts.CLUSTER_NAME_DEFAULT, testPublicAppNamespace);
 
 
-    Pageable page = new PageRequest(0, 10);
+    Pageable page = PageRequest.of(0, 10);
 
     when(namespaceRepository.findByNamespaceName(testPublicAppNamespace, page))
         .thenReturn(Arrays.asList(firstParentNamespace, secondParentNamespace));

+ 1 - 1
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseCreationTest.java

@@ -36,7 +36,7 @@ public class ReleaseCreationTest extends AbstractIntegrationTest {
   private String testApp = "test";
   private String testNamespace = "application";
   private String operator = "apollo";
-  private Pageable pageable = new PageRequest(0, 10);
+  private Pageable pageable = PageRequest.of(0, 10);
 
   @Test
   @Sql(scripts = "/sql/release-creation-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)

+ 6 - 5
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java

@@ -9,6 +9,7 @@ import com.ctrip.framework.apollo.biz.entity.Release;
 import com.ctrip.framework.apollo.biz.repository.ReleaseRepository;
 import com.ctrip.framework.apollo.common.exception.BadRequestException;
 
+import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -65,13 +66,13 @@ public class ReleaseServiceTest extends AbstractUnitTest {
     secondRelease.setNamespaceName(namespaceName);
     secondRelease.setAbandoned(false);
 
-    pageRequest = new PageRequest(0, 2);
+    pageRequest = PageRequest.of(0, 2);
   }
 
   @Test(expected = BadRequestException.class)
   public void testNamespaceNotExist() {
 
-    when(releaseRepository.findOne(releaseId)).thenReturn(firstRelease);
+    when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease));
 
     releaseService.rollback(releaseId, user);
   }
@@ -79,7 +80,7 @@ public class ReleaseServiceTest extends AbstractUnitTest {
   @Test(expected = BadRequestException.class)
   public void testHasNoRelease() {
 
-    when(releaseRepository.findOne(releaseId)).thenReturn(firstRelease);
+    when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease));
     when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(appId,
                                                                                                      clusterName,
                                                                                                      namespaceName,
@@ -92,7 +93,7 @@ public class ReleaseServiceTest extends AbstractUnitTest {
   @Test
   public void testRollback() {
 
-    when(releaseRepository.findOne(releaseId)).thenReturn(firstRelease);
+    when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease));
     when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(appId,
                                                                                                      clusterName,
                                                                                                      namespaceName,
@@ -166,7 +167,7 @@ public class ReleaseServiceTest extends AbstractUnitTest {
     List<Release> someReleases = Lists.newArrayList(someRelease, anotherRelease);
     Set<Long> someReleaseIds = Sets.newHashSet(someReleaseId, anotherReleaseId);
 
-    when(releaseRepository.findAll(someReleaseIds)).thenReturn(someReleases);
+    when(releaseRepository.findAllById(someReleaseIds)).thenReturn(someReleases);
 
     List<Release> result = releaseService.findByReleaseIds(someReleaseIds);
 

+ 1 - 1
apollo-biz/src/test/resources/application.properties

@@ -1,5 +1,5 @@
 spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE
-spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
+spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true

+ 0 - 1
apollo-client/src/test/java/com/ctrip/framework/apollo/internals/PropertiesConfigFileTest.java

@@ -6,7 +6,6 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.when;
 
-import com.ctrip.framework.apollo.ConfigFile;
 import com.ctrip.framework.apollo.ConfigFileChangeListener;
 import com.ctrip.framework.apollo.enums.PropertyChangeType;
 import com.ctrip.framework.apollo.model.ConfigFileChangeEvent;

+ 0 - 3
apollo-client/src/test/java/com/ctrip/framework/apollo/internals/RemoteConfigLongPollServiceTest.java

@@ -3,7 +3,6 @@ package com.ctrip.framework.apollo.internals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
@@ -12,11 +11,9 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import com.ctrip.framework.apollo.Apollo;
 import java.lang.reflect.Type;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 

+ 7 - 7
apollo-client/src/test/java/com/ctrip/framework/apollo/spring/BootstrapConfigTest.java

@@ -20,7 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.test.annotation.DirtiesContext;
@@ -36,7 +36,7 @@ public class BootstrapConfigTest {
   private static final String FX_APOLLO_NAMESPACE = "FX.apollo";
 
   @RunWith(SpringJUnit4ClassRunner.class)
-  @SpringApplicationConfiguration(ConfigurationWithConditionalOnProperty.class)
+  @SpringBootTest(classes = ConfigurationWithConditionalOnProperty.class)
   @DirtiesContext
   public static class TestWithBootstrapEnabledAndDefaultNamespacesAndConditionalOn extends
       AbstractSpringIntegrationTest {
@@ -90,7 +90,7 @@ public class BootstrapConfigTest {
   }
 
   @RunWith(SpringJUnit4ClassRunner.class)
-  @SpringApplicationConfiguration(ConfigurationWithConditionalOnProperty.class)
+  @SpringBootTest(classes = ConfigurationWithConditionalOnProperty.class)
   @DirtiesContext
   public static class TestWithBootstrapEnabledAndNamespacesAndConditionalOn extends
       AbstractSpringIntegrationTest {
@@ -132,7 +132,7 @@ public class BootstrapConfigTest {
   }
 
   @RunWith(SpringJUnit4ClassRunner.class)
-  @SpringApplicationConfiguration(ConfigurationWithConditionalOnProperty.class)
+  @SpringBootTest(classes = ConfigurationWithConditionalOnProperty.class)
   @DirtiesContext
   public static class TestWithBootstrapEnabledAndDefaultNamespacesAndConditionalOnFailed extends
       AbstractSpringIntegrationTest {
@@ -168,7 +168,7 @@ public class BootstrapConfigTest {
   }
 
   @RunWith(SpringJUnit4ClassRunner.class)
-  @SpringApplicationConfiguration(ConfigurationWithoutConditionalOnProperty.class)
+  @SpringBootTest(classes = ConfigurationWithoutConditionalOnProperty.class)
   @DirtiesContext
   public static class TestWithBootstrapEnabledAndDefaultNamespacesAndConditionalOff extends
       AbstractSpringIntegrationTest {
@@ -202,7 +202,7 @@ public class BootstrapConfigTest {
   }
 
   @RunWith(SpringJUnit4ClassRunner.class)
-  @SpringApplicationConfiguration(ConfigurationWithConditionalOnProperty.class)
+  @SpringBootTest(classes = ConfigurationWithConditionalOnProperty.class)
   @DirtiesContext
   public static class TestWithBootstrapDisabledAndDefaultNamespacesAndConditionalOn extends
       AbstractSpringIntegrationTest {
@@ -234,7 +234,7 @@ public class BootstrapConfigTest {
   }
 
   @RunWith(SpringJUnit4ClassRunner.class)
-  @SpringApplicationConfiguration(ConfigurationWithoutConditionalOnProperty.class)
+  @SpringBootTest(classes = ConfigurationWithoutConditionalOnProperty.class)
   @DirtiesContext
   public static class TestWithBootstrapDisabledAndDefaultNamespacesAndConditionalOff extends
       AbstractSpringIntegrationTest {

+ 0 - 11
apollo-common/pom.xml

@@ -30,17 +30,6 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-security</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-spectator</artifactId>
-            <!-- duplicated with spring-security-core -->
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.security</groupId>
-                    <artifactId>spring-security-crypto</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-jpa</artifactId>

+ 1 - 1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CharacterEncodingFilterConfiguration.java

@@ -1,6 +1,6 @@
 package com.ctrip.framework.apollo.common.controller;
 
-import org.springframework.boot.context.embedded.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.filter.CharacterEncodingFilter;

+ 1 - 1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/HttpMessageConverterConfiguration.java

@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.common.controller;
 import com.google.common.collect.Lists;
 import com.google.gson.GsonBuilder;
 
-import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.converter.ByteArrayHttpMessageConverter;

+ 8 - 8
apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/WebMvcConfig.java

@@ -1,26 +1,26 @@
 package com.ctrip.framework.apollo.common.controller;
 
-import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
-import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
-import org.springframework.boot.context.embedded.MimeMappings;
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
+import org.springframework.boot.web.server.MimeMappings;
+import org.springframework.boot.web.server.WebServerFactoryCustomizer;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
 import org.springframework.http.MediaType;
 import org.springframework.web.method.support.HandlerMethodArgumentResolver;
 import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 import java.util.List;
 
 @Configuration
-public class WebMvcConfig extends WebMvcConfigurerAdapter implements EmbeddedServletContainerCustomizer {
+public class WebMvcConfig implements WebMvcConfigurer, WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
 
   @Override
   public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
     PageableHandlerMethodArgumentResolver pageResolver =
             new PageableHandlerMethodArgumentResolver();
-    pageResolver.setFallbackPageable(new PageRequest(0, 10));
+    pageResolver.setFallbackPageable(PageRequest.of(0, 10));
 
     argumentResolvers.add(pageResolver);
   }
@@ -32,9 +32,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter implements EmbeddedSer
   }
 
   @Override
-  public void customize(ConfigurableEmbeddedServletContainer container) {
+  public void customize(TomcatServletWebServerFactory factory) {
     MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
     mappings.add("html", "text/html;charset=utf-8");
-    container.setMimeMappings(mappings );
+    factory.setMimeMappings(mappings );
   }
 }

+ 0 - 50
apollo-common/src/main/java/com/ctrip/framework/apollo/common/customize/TomcatContainerCustomizer.java

@@ -1,50 +0,0 @@
-package com.ctrip.framework.apollo.common.customize;
-
-import org.apache.catalina.connector.Connector;
-import org.apache.coyote.ProtocolHandler;
-import org.apache.coyote.http11.Http11NioProtocol;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
-import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
-import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer;
-import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-/**
- * @author Jason Song(song_s@ctrip.com)
- */
-@Component
-public class TomcatContainerCustomizer implements EmbeddedServletContainerCustomizer {
-  private static final Logger logger = LoggerFactory.getLogger(TomcatContainerCustomizer.class);
-  private static final String TOMCAT_ACCEPTOR_COUNT = "server.tomcat.accept-count";
-  @Autowired
-  private Environment environment;
-
-  @Override
-  public void customize(ConfigurableEmbeddedServletContainer container) {
-    if (!(container instanceof TomcatEmbeddedServletContainerFactory)) {
-      return;
-    }
-    if (!environment.containsProperty(TOMCAT_ACCEPTOR_COUNT)) {
-      return;
-    }
-    TomcatEmbeddedServletContainerFactory tomcat =
-        (TomcatEmbeddedServletContainerFactory) container;
-    tomcat.addConnectorCustomizers(new TomcatConnectorCustomizer() {
-      @Override
-      public void customize(Connector connector) {
-        ProtocolHandler handler = connector.getProtocolHandler();
-        if (handler instanceof Http11NioProtocol) {
-          Http11NioProtocol http = (Http11NioProtocol) handler;
-          int acceptCount = Integer.parseInt(environment.getProperty(TOMCAT_ACCEPTOR_COUNT));
-          http.setBacklog(acceptCount);
-          logger.info("Setting tomcat accept count to {}", acceptCount);
-        }
-
-      }
-    });
-  }
-}

+ 2 - 1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/BaseEntity.java

@@ -7,6 +7,7 @@ import java.util.Date;
 
 import javax.persistence.Column;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Inheritance;
 import javax.persistence.InheritanceType;
@@ -20,7 +21,7 @@ import javax.persistence.PreUpdate;
 public abstract class BaseEntity {
 
   @Id
-  @GeneratedValue
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "Id")
   private long id;
 

+ 6 - 7
apollo-common/src/main/resources/application.properties

@@ -1,18 +1,17 @@
 spring.http.converters.preferred-json-mapper=gson
 
 # DataSource
-spring.datasource.testWhileIdle=true
-spring.datasource.testOnBorrow=true
-spring.datasource.validationQuery=SELECT 1
-spring.datasource.validationInterval=5000
-spring.datasource.initSQL=set names utf8mb4
+spring.datasource.hikari.connectionInitSql=set names utf8mb4
 
 # Naming strategy
-spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
+spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
 spring.jpa.hibernate.globally_quoted_identifiers=true
 spring.jpa.properties.hibernate.globally_quoted_identifiers=true
 
 # Tomcat configuration
 server.tomcat.accept-count=5000
 # Increase tomcat header size for longer GET query parameter, should be n * 1024
-server.tomcat.maxHttpHeaderSize=10240
+server.max-http-header-size=10240
+
+# Spring Boot 2.0
+management.endpoints.web.base-path=/

+ 8 - 0
apollo-common/src/main/resources/banner.txt

@@ -0,0 +1,8 @@
+     _                _ _
+    / \   _ __   ___ | | | ___
+   / _ \ | '_ \ / _ \| | |/ _ \
+  / ___ \| |_) | (_) | | | (_) |
+ /_/   \_\ .__/ \___/|_|_|\___/
+         |_|
+
+:: Spring Boot :: ${spring-boot.formatted-version}

+ 3 - 5
apollo-configservice/pom.xml

@@ -23,16 +23,14 @@
 		<!-- eureka -->
 		<dependency>
 			<groupId>org.springframework.cloud</groupId>
-			<artifactId>spring-cloud-starter-eureka-server</artifactId>
+			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
 			<exclusions>
 				<exclusion>
-					<artifactId>
-                        spring-cloud-starter-archaius
-                    </artifactId>
+					<artifactId>spring-cloud-starter-netflix-archaius</artifactId>
 					<groupId>org.springframework.cloud</groupId>
 				</exclusion>
 				<exclusion>
-					<artifactId>spring-cloud-starter-ribbon</artifactId>
+					<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
 					<groupId>org.springframework.cloud</groupId>
 				</exclusion>
 				<exclusion>

+ 1 - 1
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServiceHealthIndicator.java

@@ -24,7 +24,7 @@ public class ConfigServiceHealthIndicator implements HealthIndicator {
   }
 
   private int check() {
-    PageRequest pageable = new PageRequest(0, 1);
+    PageRequest pageable = PageRequest.of(0, 1);
     appService.findAll(pageable);
     return 0;
   }

+ 1 - 1
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ServletInitializer.java

@@ -1,7 +1,7 @@
 package com.ctrip.framework.apollo.configservice;
 
 import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.context.web.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 
 /**
  * Entry point for traditional web app

+ 1 - 1
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/AppNamespaceServiceWithCache.java

@@ -186,7 +186,7 @@ public class AppNamespaceServiceWithCache implements InitializingBean {
     }
     List<List<Long>> partitionIds = Lists.partition(ids, 500);
     for (List<Long> toRebuild : partitionIds) {
-      Iterable<AppNamespace> appNamespaces = appNamespaceRepository.findAll(toRebuild);
+      Iterable<AppNamespace> appNamespaces = appNamespaceRepository.findAllById(toRebuild);
 
       if (appNamespaces == null) {
         continue;

+ 2 - 6
apollo-configservice/src/main/resources/bootstrap.yml

@@ -2,6 +2,8 @@ eureka:
   instance:
     hostname: ${hostname:localhost}
     preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
   server:
     peerEurekaNodesUpdateIntervalMs: 60000
     enableSelfPreservation: false
@@ -12,13 +14,7 @@ eureka:
       enabled: true
     eurekaServiceUrlPollIntervalSeconds: 60
 
-endpoints:
-  health:
-    sensitive: false
-
 management:
-  security:
-    enabled: false
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP

+ 2 - 1
apollo-configservice/src/main/resources/configservice.properties

@@ -2,4 +2,5 @@
 spring.application.name= apollo-configservice
 ctrip.appid= 100003171
 server.port= 8080
-logging.file= /opt/logs/100003171/apollo-configservice.log
+logging.file= /opt/logs/100003171/apollo-configservice.log
+spring.jmx.default-domain = apollo-configservice

+ 1 - 1
apollo-configservice/src/main/scripts/startup.sh

@@ -99,7 +99,7 @@ declare -i max_counter=48 # 48*5=240s
 declare -i total_time=0
 
 printf "Waiting for server startup"
-until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "Coyote")" != "" ]];
+until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
 do
     printf "."
     counter+=1

+ 6 - 7
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/AbstractBaseIntegrationTest.java

@@ -14,9 +14,9 @@ import com.ctrip.framework.apollo.biz.utils.ReleaseKeyGenerator;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.SpringApplicationConfiguration;
-import org.springframework.boot.test.TestRestTemplate;
-import org.springframework.boot.test.WebIntegrationTest;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
@@ -36,8 +36,7 @@ import javax.annotation.PostConstruct;
  * @author Jason Song(song_s@ctrip.com)
  */
 @RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = AbstractBaseIntegrationTest.TestConfiguration.class)
-@WebIntegrationTest(randomPort = true)
+@SpringBootTest(classes = AbstractBaseIntegrationTest.TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT)
 public abstract class AbstractBaseIntegrationTest {
   @Autowired
   private ReleaseMessageRepository releaseMessageRepository;
@@ -46,7 +45,7 @@ public abstract class AbstractBaseIntegrationTest {
 
   private Gson gson = new Gson();
 
-  RestTemplate restTemplate = new TestRestTemplate();
+  protected RestTemplate restTemplate = (new TestRestTemplate()).getRestTemplate();
 
   @PostConstruct
   private void postConstruct() {
@@ -57,7 +56,7 @@ public abstract class AbstractBaseIntegrationTest {
   int port;
 
   protected String getHostUrl() {
-    return "http://localhost:" + port;
+    return "localhost:" + port;
   }
 
   @Configuration

+ 20 - 20
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/ConfigControllerIntegrationTest.java

@@ -59,7 +59,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryConfigWithDefaultClusterAndDefaultNamespaceOK() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
             getHostUrl(), someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, ConfigConsts.NAMESPACE_APPLICATION);
     ApolloConfig result = response.getBody();
 
@@ -73,7 +73,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryConfigWithDefaultClusterAndDefaultNamespaceAndIncorrectCase() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
             getHostUrl(), someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT,
             ConfigConsts.NAMESPACE_APPLICATION.toUpperCase());
     ApolloConfig result = response.getBody();
@@ -97,7 +97,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
     stop.set(true);
 
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
             getHostUrl(), someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, ConfigConsts.NAMESPACE_APPLICATION, someClientIp);
     ApolloConfig result = response.getBody();
 
@@ -120,7 +120,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
     stop.set(true);
 
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
             getHostUrl(), someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT,
             ConfigConsts.NAMESPACE_APPLICATION.toUpperCase(), someClientIp);
     ApolloConfig result = response.getBody();
@@ -135,7 +135,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryConfigFileWithDefaultClusterAndDefaultNamespaceOK() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
             getHostUrl(), someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, ConfigConsts.NAMESPACE_APPLICATION + ".properties");
     ApolloConfig result = response.getBody();
 
@@ -149,7 +149,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryConfigWithNamespaceOK() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
             getHostUrl(), someAppId, someCluster, someNamespace);
     ApolloConfig result = response.getBody();
 
@@ -163,7 +163,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryConfigFileWithNamespaceOK() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
             getHostUrl(), someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, someNamespace + ".xml");
     ApolloConfig result = response.getBody();
 
@@ -180,7 +180,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
     HttpStatusCodeException httpException = null;
     try {
       ResponseEntity<ApolloConfig> response = restTemplate
-          .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
+          .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
               getHostUrl(), someAppId, someCluster, someNamespaceNotExists);
     } catch (HttpStatusCodeException ex) {
       httpException = ex;
@@ -195,7 +195,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   public void testQueryConfigNotModified() throws Exception {
     String releaseKey = "TEST-RELEASE-KEY2";
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?releaseKey={releaseKey}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?releaseKey={releaseKey}",
             ApolloConfig.class,
             getHostUrl(), someAppId, someCluster, someNamespace, releaseKey);
 
@@ -216,7 +216,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
     stop.set(true);
 
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
             getHostUrl(), someAppId, someCluster, somePublicNamespace, someClientIp);
     ApolloConfig result = response.getBody();
 
@@ -231,7 +231,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryPublicConfigWithDataCenterFoundAndNoOverride() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
             ApolloConfig.class,
             getHostUrl(), someAppId, someCluster, somePublicNamespace, someDC);
     ApolloConfig result = response.getBody();
@@ -250,7 +250,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryPublicConfigWithDataCenterFoundAndOverride() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
             ApolloConfig.class,
             getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDC);
     ApolloConfig result = response.getBody();
@@ -271,7 +271,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryPublicConfigWithIncorrectCaseAndDataCenterFoundAndOverride() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
             ApolloConfig.class,
             getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), someDC);
     ApolloConfig result = response.getBody();
@@ -289,7 +289,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   public void testQueryPublicConfigWithDataCenterNotFoundAndNoOverride() throws Exception {
     String someDCNotFound = "someDCNotFound";
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
             ApolloConfig.class,
             getHostUrl(), someAppId, someCluster, somePublicNamespace, someDCNotFound);
     ApolloConfig result = response.getBody();
@@ -309,7 +309,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   public void testQueryPublicConfigWithDataCenterNotFoundAndOverride() throws Exception {
     String someDCNotFound = "someDCNotFound";
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
             ApolloConfig.class,
             getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDCNotFound);
     ApolloConfig result = response.getBody();
@@ -339,7 +339,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
     stop.set(true);
 
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
             getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someClientIp);
     ApolloConfig result = response.getBody();
 
@@ -366,7 +366,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
     stop.set(true);
 
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?ip={clientIp}", ApolloConfig.class,
             getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), someClientIp);
     ApolloConfig result = response.getBody();
 
@@ -384,7 +384,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   public void testQueryPrivateConfigFileWithPublicNamespaceExists() throws Exception {
     String namespaceName = "anotherNamespace";
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}",
             ApolloConfig.class,
             getHostUrl(), someAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, namespaceName);
     ApolloConfig result = response.getBody();
@@ -403,7 +403,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
     HttpStatusCodeException httpException = null;
     try {
       ResponseEntity<ApolloConfig> response = restTemplate
-          .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
+          .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}", ApolloConfig.class,
               getHostUrl(), ConfigConsts.NO_APPID_PLACEHOLDER, someCluster, ConfigConsts.NAMESPACE_APPLICATION);
     } catch (HttpStatusCodeException ex) {
       httpException = ex;
@@ -417,7 +417,7 @@ public class ConfigControllerIntegrationTest extends AbstractBaseIntegrationTest
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testQueryPublicConfigForNoAppIdPlaceHolder() throws Exception {
     ResponseEntity<ApolloConfig> response = restTemplate
-        .getForEntity("{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+        .getForEntity("http://{baseurl}/configs/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
             ApolloConfig.class,
             getHostUrl(), ConfigConsts.NO_APPID_PLACEHOLDER, someCluster, somePublicNamespace, someDC);
     ApolloConfig result = response.getBody();

+ 15 - 15
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/ConfigFileControllerIntegrationTest.java

@@ -72,7 +72,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
   public void testQueryConfigAsProperties() throws Exception {
     ResponseEntity<String> response =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
                 getHostUrl(), someAppId, someCluster, someNamespace);
 
     String result = response.getBody();
@@ -96,12 +96,12 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
 
     ResponseEntity<String> response =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
                 getHostUrl(), someAppId, someDefaultCluster, ConfigConsts.NAMESPACE_APPLICATION, grayClientIp);
 
     ResponseEntity<String> anotherResponse =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?ip={clientIp}", String.class,
                 getHostUrl(), someAppId, someDefaultCluster, ConfigConsts.NAMESPACE_APPLICATION, nonGrayClientIp);
 
     String result = response.getBody();
@@ -123,7 +123,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
     ResponseEntity<String> response =
         restTemplate
             .getForEntity(
-                "{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+                "http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
                 String.class,
                 getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDC);
 
@@ -140,7 +140,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
   public void testQueryConfigAsJson() throws Exception {
     ResponseEntity<String> response =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
                 getHostUrl(), someAppId, someCluster, someNamespace);
 
     Map<String, String> configs = gson.fromJson(response.getBody(), mapResponseType);
@@ -155,7 +155,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
   public void testQueryConfigAsJsonWithIncorrectCase() throws Exception {
     ResponseEntity<String> response =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}", String.class,
                 getHostUrl(), someAppId, someCluster, someNamespace.toUpperCase());
 
     Map<String, String> configs = gson.fromJson(response.getBody(), mapResponseType);
@@ -172,7 +172,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
     ResponseEntity<String> response =
         restTemplate
             .getForEntity(
-                "{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+                "http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
                 String.class,
                 getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, someDC);
 
@@ -191,7 +191,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
     ResponseEntity<String> response =
         restTemplate
             .getForEntity(
-                "{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
+                "http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?dataCenter={dateCenter}",
                 String.class,
                 getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), someDC);
 
@@ -219,14 +219,14 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
     ResponseEntity<String> response =
         restTemplate
             .getForEntity(
-                "{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
+                "http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
                 String.class,
                 getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, grayClientIp);
 
     ResponseEntity<String> anotherResponse =
         restTemplate
             .getForEntity(
-                "{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
+                "http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
                 String.class,
                 getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace, nonGrayClientIp);
 
@@ -260,14 +260,14 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
     ResponseEntity<String> response =
         restTemplate
             .getForEntity(
-                "{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
+                "http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
                 String.class,
                 getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), grayClientIp);
 
     ResponseEntity<String> anotherResponse =
         restTemplate
             .getForEntity(
-                "{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
+                "http://{baseurl}/configfiles/json/{appId}/{clusterName}/{namespace}?ip={clientIp}",
                 String.class,
                 getHostUrl(), someAppId, someDefaultCluster, somePublicNamespace.toUpperCase(), nonGrayClientIp);
 
@@ -290,7 +290,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
   public void testConfigChanged() throws Exception {
     ResponseEntity<String> response =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
                 getHostUrl(), someAppId, someCluster, someNamespace);
 
     String result = response.getBody();
@@ -312,7 +312,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
 
     ResponseEntity<String> anotherResponse =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
                 getHostUrl(), someAppId, someCluster, someNamespace);
 
     assertEquals(response.getBody(), anotherResponse.getBody());
@@ -325,7 +325,7 @@ public class ConfigFileControllerIntegrationTest extends AbstractBaseIntegration
 
     ResponseEntity<String> newResponse =
         restTemplate
-            .getForEntity("{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
+            .getForEntity("http://{baseurl}/configfiles/{appId}/{clusterName}/{namespace}", String.class,
                 getHostUrl(), someAppId, someCluster, someNamespace);
 
     result = newResponse.getBody();

+ 9 - 9
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/NotificationControllerIntegrationTest.java

@@ -57,7 +57,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
     periodicSendMessage(executorService, assembleKey(someAppId, someCluster, defaultNamespace), stop);
 
     ResponseEntity<ApolloConfigNotification> result = restTemplate.getForEntity(
-        "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
+        "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
         ApolloConfigNotification.class,
         getHostUrl(), someAppId, someCluster, defaultNamespace);
 
@@ -76,7 +76,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
     periodicSendMessage(executorService, assembleKey(someAppId, someCluster, defaultNamespace), stop);
 
     ResponseEntity<ApolloConfigNotification> result = restTemplate.getForEntity(
-        "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
+        "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
         ApolloConfigNotification.class,
         getHostUrl(), someAppId, someCluster, defaultNamespace + ".properties");
 
@@ -98,7 +98,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
 
     ResponseEntity<ApolloConfigNotification> result = restTemplate
         .getForEntity(
-            "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
+            "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
             ApolloConfigNotification.class,
             getHostUrl(), someAppId, someCluster, namespace);
 
@@ -115,7 +115,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
   @Sql(scripts = "/integration-test/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testPollNotificationWithDefaultNamespaceWithNotificationIdNull() throws Exception {
     ResponseEntity<ApolloConfigNotification> result = restTemplate.getForEntity(
-        "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
+        "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
         ApolloConfigNotification.class,
         getHostUrl(), someAppId, someCluster, defaultNamespace);
 
@@ -132,7 +132,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
   public void testPollNotificationWithDefaultNamespaceWithNotificationIdOutDated() throws Exception {
     long someOutDatedNotificationId = 1;
     ResponseEntity<ApolloConfigNotification> result = restTemplate.getForEntity(
-        "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&notificationId={notificationId}",
+        "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&notificationId={notificationId}",
         ApolloConfigNotification.class,
         getHostUrl(), someAppId, someCluster, defaultNamespace, someOutDatedNotificationId);
 
@@ -153,7 +153,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
 
     ResponseEntity<ApolloConfigNotification> result = restTemplate
         .getForEntity(
-            "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
+            "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}",
             ApolloConfigNotification.class,
             getHostUrl(), someAppId, someCluster, somePublicNamespace);
 
@@ -177,7 +177,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
 
     ResponseEntity<ApolloConfigNotification> result = restTemplate
         .getForEntity(
-            "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&dataCenter={dataCenter}",
+            "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&dataCenter={dataCenter}",
             ApolloConfigNotification.class,
             getHostUrl(), someAppId, someCluster, somePublicNamespace, someDC);
 
@@ -201,7 +201,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
 
     ResponseEntity<ApolloConfigNotification> result = restTemplate
         .getForEntity(
-            "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&dataCenter={dataCenter}",
+            "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&dataCenter={dataCenter}",
             ApolloConfigNotification.class,
             getHostUrl(), someAppId, someCluster, somePublicNamespace + ".properties", someDC);
 
@@ -220,7 +220,7 @@ public class NotificationControllerIntegrationTest extends AbstractBaseIntegrati
   public void testPollNotificationWithPublicNamespaceWithNotificationIdOutDated() throws Exception {
     long someOutDatedNotificationId = 1;
     ResponseEntity<ApolloConfigNotification> result = restTemplate.getForEntity(
-        "{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&notificationId={notificationId}",
+        "http://{baseurl}/notifications?appId={appId}&cluster={clusterName}&namespace={namespace}&notificationId={notificationId}",
         ApolloConfigNotification.class,
         getHostUrl(), someAppId, someCluster, somePublicNamespace, someOutDatedNotificationId);
 

+ 17 - 17
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/integration/NotificationControllerV2IntegrationTest.java

@@ -68,7 +68,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     periodicSendMessage(executorService, key, stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(defaultNamespace, ConfigConsts.NOTIFICATION_ID_PLACEHOLDER));
@@ -96,7 +96,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
         stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(defaultNamespace + ".properties",
@@ -124,7 +124,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     periodicSendMessage(executorService, key, stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(defaultNamespace + ".properties",
@@ -156,7 +156,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     String somePublicNamespaceWithIncorrectCase = somePublicNamespace.toUpperCase();
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(defaultNamespace + ".properties",
@@ -189,7 +189,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     periodicSendMessage(executorService, key, stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(namespace, ConfigConsts.NOTIFICATION_ID_PLACEHOLDER));
@@ -216,7 +216,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
       throws Exception {
     long someOutDatedNotificationId = 1;
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(defaultNamespace, someOutDatedNotificationId));
@@ -247,7 +247,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     periodicSendMessage(executorService, key, stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespace, ConfigConsts.NOTIFICATION_ID_PLACEHOLDER));
@@ -278,7 +278,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     periodicSendMessage(executorService, key, stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}&dataCenter={dataCenter}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}&dataCenter={dataCenter}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespace, ConfigConsts.NOTIFICATION_ID_PLACEHOLDER),
@@ -311,7 +311,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     periodicSendMessage(executorService, key, stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}&dataCenter={dataCenter}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}&dataCenter={dataCenter}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(defaultNamespace, ConfigConsts.NOTIFICATION_ID_PLACEHOLDER,
@@ -344,7 +344,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     periodicSendMessage(executorService, key, stop);
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}&dataCenter={dataCenter}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}&dataCenter={dataCenter}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespace + ".properties",
@@ -373,7 +373,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     long someOutDatedNotificationId = 1;
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespace,
@@ -407,7 +407,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
 
     //the same namespace with difference character case, and difference notification id
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespace, newNotificationId,
@@ -440,7 +440,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
 
     //the same namespace with difference character case, and difference notification id
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNameWithIncorrectCase, someOutDatedNotificationId,
@@ -473,7 +473,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
 
     //the same namespace with difference character case, and difference notification id
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNameWithIncorrectCase, newNotificationId,
@@ -506,7 +506,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
 
     //the same namespace with difference character case, and difference notification id
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespace, someOutDatedNotificationId,
@@ -538,7 +538,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     long newPublicNamespaceNotification = 20;
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespace,
@@ -592,7 +592,7 @@ public class NotificationControllerV2IntegrationTest extends AbstractBaseIntegra
     String somePublicNamespaceWithIncorrectCase = somePublicNamespace.toUpperCase();
 
     ResponseEntity<List<ApolloConfigNotification>> result = restTemplate.exchange(
-        "{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
+        "http://{baseurl}/notifications/v2?appId={appId}&cluster={clusterName}&notifications={notifications}",
         HttpMethod.GET, null, typeReference,
         getHostUrl(), someAppId, someCluster,
         transformApolloConfigNotificationsToString(somePublicNamespaceWithIncorrectCase,

+ 3 - 3
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/AppNamespaceServiceWithCacheTest.java

@@ -133,7 +133,7 @@ public class AppNamespaceServiceWithCacheTest {
     // Add 1 private namespace and 1 public namespace
     when(appNamespaceRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0)).thenReturn(Lists
         .newArrayList(somePrivateAppNamespace, somePublicAppNamespace));
-    when(appNamespaceRepository.findAll(Lists.newArrayList(somePrivateNamespaceId,
+    when(appNamespaceRepository.findAllById(Lists.newArrayList(somePrivateNamespaceId,
         somePublicNamespaceId))).thenReturn(Lists.newArrayList(somePrivateAppNamespace,
         somePublicAppNamespace));
 
@@ -165,7 +165,7 @@ public class AppNamespaceServiceWithCacheTest {
     when(appNamespaceRepository.findFirst500ByIdGreaterThanOrderByIdAsc(somePublicNamespaceId))
         .thenReturn(Lists.newArrayList(anotherPrivateAppNamespace, yetAnotherPrivateAppNamespace,
             anotherPublicAppNamespace));
-    when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(allAppNamespaces);
+    when(appNamespaceRepository.findAllById(appNamespaceIds)).thenReturn(allAppNamespaces);
 
     scanIntervalTimeUnit.sleep(sleepInterval);
 
@@ -213,7 +213,7 @@ public class AppNamespaceServiceWithCacheTest {
         (somePublicAppNamespace.getDataChangeLastModifiedTime(), 1));
 
     // Delete 1 private and 1 public
-    when(appNamespaceRepository.findAll(appNamespaceIds)).thenReturn(Lists.newArrayList
+    when(appNamespaceRepository.findAllById(appNamespaceIds)).thenReturn(Lists.newArrayList
         (somePrivateAppNamespaceNew, yetAnotherPrivateAppNamespaceNew, somePublicAppNamespaceNew));
 
     scanIntervalTimeUnit.sleep(sleepInterval);

+ 1 - 1
apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/wrapper/CaseInsensitiveMapWrapperTest.java

@@ -64,4 +64,4 @@ public class CaseInsensitiveMapWrapperTest {
 
     verify(someMap, times(1)).remove(someKey.toLowerCase());
   }
-}
+}

+ 1 - 1
apollo-configservice/src/test/resources/application.properties

@@ -1,5 +1,5 @@
 spring.datasource.url = jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1
-spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
+spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true
 spring.jpa.properties.hibernate.show_sql=false

+ 2 - 7
apollo-configservice/src/test/resources/bootstrap.yml

@@ -2,20 +2,15 @@ eureka:
   instance:
     hostname: ${hostname:localhost}
     preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
   client:
     serviceUrl:
       defaultZone: http://${eureka.instance.hostname}:8080/eureka/
     healthcheck:
       enabled: true
       
-      
-endpoints:
-  health:
-    sensitive: false
-
 management:
-  security:
-    enabled: false
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 2 - 2
apollo-mockserver/src/test/java/com/ctrip/framework/apollo/mockserver/ApolloMockServerSpringIntegrationTest.java

@@ -16,7 +16,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.test.annotation.DirtiesContext;
@@ -26,7 +26,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  * Create by zhangzheng on 8/16/18 Email:zhangzheng@youzan.com
  */
 @RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = TestConfiguration.class)
+@SpringBootTest(classes = TestConfiguration.class)
 public class ApolloMockServerSpringIntegrationTest {
 
   private static final String otherNamespace = "otherNamespace";

+ 2 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerAudit.java

@@ -7,6 +7,7 @@ import java.util.Date;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.PrePersist;
 import javax.persistence.Table;
@@ -18,7 +19,7 @@ import javax.persistence.Table;
 @Table(name = "ConsumerAudit")
 public class ConsumerAudit {
   @Id
-  @GeneratedValue
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "Id")
   private long id;
 

+ 2 - 2
apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java

@@ -109,7 +109,7 @@ public class ConsumerService {
   }
 
   public Consumer getConsumerByConsumerId(long consumerId) {
-    return consumerRepository.findOne(consumerId);
+    return consumerRepository.findById(consumerId).orElse(null);
   }
 
   public List<ConsumerRole> assignNamespaceRoleToConsumer(String token, String appId, String namespaceName) {
@@ -177,7 +177,7 @@ public class ConsumerService {
 
   @Transactional
   public void createConsumerAudits(Iterable<ConsumerAudit> consumerAudits) {
-    consumerAuditRepository.save(consumerAudits);
+    consumerAuditRepository.saveAll(consumerAudits);
   }
 
   @Transactional

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/AdminServiceAddressLocator.java

@@ -11,7 +11,7 @@ import com.ctrip.framework.apollo.tracer.Tracer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.client.RestTemplate;

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.java

@@ -7,7 +7,7 @@ import org.apache.http.impl.client.HttpClientBuilder;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;

+ 2 - 2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RetryableRestTemplate.java

@@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestTemplate;
-import org.springframework.web.util.DefaultUriTemplateHandler;
+import org.springframework.web.util.DefaultUriBuilderFactory;
 import org.springframework.web.util.UriTemplateHandler;
 
 import java.net.SocketTimeoutException;
@@ -36,7 +36,7 @@ public class RetryableRestTemplate {
 
   private Logger logger = LoggerFactory.getLogger(RetryableRestTemplate.class);
 
-  private UriTemplateHandler uriTemplateHandler = new DefaultUriTemplateHandler();
+  private UriTemplateHandler uriTemplateHandler = new DefaultUriBuilderFactory();
 
   private RestTemplate restTemplate;
 

+ 2 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/UserPO.java

@@ -5,6 +5,7 @@ import com.ctrip.framework.apollo.portal.entity.bo.UserInfo;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
@@ -16,7 +17,7 @@ import javax.persistence.Table;
 public class UserPO {
 
   @Id
-  @GeneratedValue
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "Id")
   private long id;
   @Column(name = "Username", nullable = false)

+ 2 - 2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/FavoriteService.java

@@ -77,7 +77,7 @@ public class FavoriteService {
 
 
   public void deleteFavorite(long favoriteId) {
-    Favorite favorite = favoriteRepository.findOne(favoriteId);
+    Favorite favorite = favoriteRepository.findById(favoriteId).orElse(null);
 
     checkUserOperatePermission(favorite);
 
@@ -85,7 +85,7 @@ public class FavoriteService {
   }
 
   public void adjustFavoriteToFirst(long favoriteId) {
-    Favorite favorite = favoriteRepository.findOne(favoriteId);
+    Favorite favorite = favoriteRepository.findById(favoriteId).orElse(null);
 
     checkUserOperatePermission(favorite);
 

+ 4 - 5
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java

@@ -22,13 +22,12 @@ import java.util.Collections;
 import java.util.EventListener;
 import java.util.Map;
 import javax.servlet.Filter;
-import org.apache.tomcat.jdbc.pool.DataSource;
+import javax.sql.DataSource;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.context.embedded.FilterRegistrationBean;
-import org.springframework.boot.context.embedded.ServletListenerRegistrationBean;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Profile;
@@ -38,13 +37,13 @@ import org.springframework.ldap.core.ContextSource;
 import org.springframework.ldap.core.LdapOperations;
 import org.springframework.ldap.core.LdapTemplate;
 import org.springframework.ldap.core.support.LdapContextSource;
-import org.springframework.security.authentication.encoding.LdapShaPasswordEncoder;
 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.LdapShaPasswordEncoder;
 import org.springframework.security.provisioning.JdbcUserDetailsManager;
 import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
 

+ 1 - 1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthFilterConfiguration.java

@@ -4,7 +4,7 @@ import com.ctrip.framework.apollo.openapi.filter.ConsumerAuthenticationFilter;
 import com.ctrip.framework.apollo.openapi.util.ConsumerAuditUtil;
 import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtil;
 
-import org.springframework.boot.context.embedded.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 

+ 2 - 2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/WebContextConfiguration.java

@@ -7,8 +7,8 @@ import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
 import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.FilterRegistrationBean;
-import org.springframework.boot.context.embedded.ServletContextInitializer;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.ServletContextInitializer;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Profile;

+ 4 - 4
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/defaultimpl/DefaultRolePermissionService.java

@@ -60,7 +60,7 @@ public class DefaultRolePermissionService implements RolePermissionService {
                         rolePermission.setDataChangeLastModifiedBy(createdRole.getDataChangeLastModifiedBy());
                         return rolePermission;
                     });
-            rolePermissionRepository.save(rolePermissions);
+            rolePermissionRepository.saveAll(rolePermissions);
         }
 
         return createdRole;
@@ -93,7 +93,7 @@ public class DefaultRolePermissionService implements RolePermissionService {
             return userRole;
         });
 
-        userRoleRepository.save(toCreate);
+        userRoleRepository.saveAll(toCreate);
         return toAssignUserIds;
     }
 
@@ -114,7 +114,7 @@ public class DefaultRolePermissionService implements RolePermissionService {
             userRole.setDataChangeLastModifiedBy(operatorUserId);
         }
 
-        userRoleRepository.save(existedUserRoles);
+        userRoleRepository.saveAll(existedUserRoles);
     }
 
     /**
@@ -218,7 +218,7 @@ public class DefaultRolePermissionService implements RolePermissionService {
                     targetId);
         }
 
-        Iterable<Permission> results = permissionRepository.save(permissions);
+        Iterable<Permission> results = permissionRepository.saveAll(permissions);
         return FluentIterable.from(results).toSet();
     }
 

+ 3 - 6
apollo-portal/src/main/resources/application.yml

@@ -4,7 +4,9 @@ spring:
   profiles:
     active: ${apollo_profile}
   resources:
-    cache-period: 3600
+    cache:
+      cachecontrol:
+        max-age: 3600
 
 server:
   port: 8080
@@ -13,12 +15,7 @@ logging:
   path: /opt/logs/100003173
   file: ${logging.path}/apollo-portal.log
 
-endpoints:
-  health:
-    sensitive: false
 management:
-  security:
-    enabled: false
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 1 - 1
apollo-portal/src/main/scripts/startup.sh

@@ -99,7 +99,7 @@ declare -i max_counter=48 # 48*5=240s
 declare -i total_time=0
 
 printf "Waiting for server startup"
-until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "Coyote")" != "" ]];
+until [[ (( counter -ge max_counter )) || "$(curl -X GET --silent --connect-timeout 1 --max-time 2 --head $SERVER_URL | grep "HTTP")" != "" ]];
 do
     printf "."
     counter+=1

+ 1 - 1
apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/filter/ConsumerAuthenticationFilterTest.java

@@ -72,4 +72,4 @@ public class ConsumerAuthenticationFilterTest {
     verify(consumerAuditUtil, never()).audit(eq(request), anyLong());
     verify(filterChain, never()).doFilter(request, response);
   }
-}
+}

+ 4 - 3
apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/service/ConsumerServiceTest.java

@@ -16,6 +16,7 @@ import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
 import com.ctrip.framework.apollo.portal.spi.UserService;
 import com.ctrip.framework.apollo.portal.util.RoleUtils;
 
+import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.InjectMocks;
@@ -97,10 +98,10 @@ public class ConsumerServiceTest extends AbstractUnitTest {
     long someConsumerId = 1;
     Consumer someConsumer = mock(Consumer.class);
 
-    when(consumerRepository.findOne(someConsumerId)).thenReturn(someConsumer);
+    when(consumerRepository.findById(someConsumerId)).thenReturn(Optional.of(someConsumer));
 
     assertEquals(someConsumer, consumerService.getConsumerByConsumerId(someConsumerId));
-    verify(consumerRepository, times(1)).findOne(someConsumerId);
+    verify(consumerRepository, times(1)).findById(someConsumerId);
   }
 
   @Test
@@ -131,7 +132,7 @@ public class ConsumerServiceTest extends AbstractUnitTest {
     Date generationTime = new Date();
     Consumer consumer = mock(Consumer.class);
 
-    when(consumerRepository.findOne(someConsumerId)).thenReturn(consumer);
+    when(consumerRepository.findById(someConsumerId)).thenReturn(Optional.of(consumer));
     when(consumer.getAppId()).thenReturn(someConsumerAppId);
     when(consumerService.generateToken(someConsumerAppId, generationTime, someTokenSalt))
         .thenReturn(someToken);

+ 1 - 1
apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/util/ConsumerAuditUtilTest.java

@@ -88,4 +88,4 @@ public class ConsumerAuditUtilTest {
     assertEquals(someConsumerId, audit.getConsumerId());
   }
 
-}
+}

+ 1 - 1
apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/util/ConsumerAuthUtilTest.java

@@ -76,4 +76,4 @@ public class ConsumerAuthUtilTest {
     consumerAuthUtil.retrieveConsumerId(request);
   }
 
-}
+}

+ 5 - 6
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/AbstractIntegrationTest.java

@@ -3,9 +3,9 @@ package com.ctrip.framework.apollo.portal;
 
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.SpringApplicationConfiguration;
-import org.springframework.boot.test.TestRestTemplate;
-import org.springframework.boot.test.WebIntegrationTest;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.web.client.DefaultResponseErrorHandler;
 import org.springframework.web.client.RestTemplate;
@@ -13,11 +13,10 @@ import org.springframework.web.client.RestTemplate;
 import javax.annotation.PostConstruct;
 
 @RunWith(SpringJUnit4ClassRunner.class)
-@SpringApplicationConfiguration(classes = PortalApplication.class)
-@WebIntegrationTest(randomPort = true)
+@SpringBootTest(classes = PortalApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
 public abstract class AbstractIntegrationTest {
 
-  RestTemplate restTemplate = new TestRestTemplate();
+  protected RestTemplate restTemplate = (new TestRestTemplate()).getRestTemplate();
  
   @PostConstruct
   private void postConstruct() {

+ 8 - 8
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/FavoriteServiceTest.java

@@ -35,7 +35,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
     Favorite favorite = instanceOfFavorite(testUser, testApp);
     favoriteService.addFavorite(favorite);
 
-    List<Favorite> createdFavorites = favoriteService.search(testUser, testApp, new PageRequest(0, 10));
+    List<Favorite> createdFavorites = favoriteService.search(testUser, testApp, PageRequest.of(0, 10));
 
     Assert.assertEquals(1, createdFavorites.size());
 
@@ -57,7 +57,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
   @Sql(scripts = "/sql/favorites/favorites.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
   @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testSearchByUserId() {
-    List<Favorite> favorites = favoriteService.search(testUser, null, new PageRequest(0, 10));
+    List<Favorite> favorites = favoriteService.search(testUser, null, PageRequest.of(0, 10));
     Assert.assertEquals(4, favorites.size());
   }
 
@@ -65,7 +65,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
   @Sql(scripts = "/sql/favorites/favorites.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
   @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testSearchByAppId() {
-    List<Favorite> favorites = favoriteService.search(null, "test0621-04", new PageRequest(0, 10));
+    List<Favorite> favorites = favoriteService.search(null, "test0621-04", PageRequest.of(0, 10));
     Assert.assertEquals(3, favorites.size());
   }
 
@@ -73,7 +73,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
   @Sql(scripts = "/sql/favorites/favorites.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
   @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testSearchByAppIdAndUserId() {
-    List<Favorite> favorites = favoriteService.search(testUser, "test0621-04", new PageRequest(0, 10));
+    List<Favorite> favorites = favoriteService.search(testUser, "test0621-04", PageRequest.of(0, 10));
     Assert.assertEquals(1, favorites.size());
   }
 
@@ -81,7 +81,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
   @Sql(scripts = "/sql/favorites/favorites.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
   @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
   public void testSearchWithErrorParams() {
-    favoriteService.search(null, null, new PageRequest(0, 10));
+    favoriteService.search(null, null, PageRequest.of(0, 10));
   }
 
   @Test
@@ -90,7 +90,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
   public void testDeleteFavorite() {
     long legalFavoriteId = 21L;
     favoriteService.deleteFavorite(legalFavoriteId);
-    Assert.assertNull(favoriteRepository.findOne(legalFavoriteId));
+    Assert.assertNull(favoriteRepository.findById(legalFavoriteId).orElse(null));
   }
 
   @Test(expected = BadRequestException.class)
@@ -99,7 +99,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
   public void testDeleteFavoriteFail() {
     long anotherPersonFavoriteId = 23L;
     favoriteService.deleteFavorite(anotherPersonFavoriteId);
-    Assert.assertNull(favoriteRepository.findOne(anotherPersonFavoriteId));
+    Assert.assertNull(favoriteRepository.findById(anotherPersonFavoriteId).orElse(null));
   }
 
   @Test(expected = BadRequestException.class)
@@ -117,7 +117,7 @@ public class FavoriteServiceTest extends AbstractIntegrationTest {
     long toAdjustFavoriteId = 20;
     favoriteService.adjustFavoriteToFirst(toAdjustFavoriteId);
 
-    List<Favorite> favorites = favoriteService.search(testUser, null, new PageRequest(0, 10));
+    List<Favorite> favorites = favoriteService.search(testUser, null, PageRequest.of(0, 10));
     Favorite firstFavorite = favorites.get(0);
     Favorite secondFavorite = favorites.get(1);
 

+ 3 - 3
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/spi/defaultImpl/RolePermissionServiceTest.java

@@ -67,7 +67,7 @@ public class RolePermissionServiceTest extends AbstractIntegrationTest {
 
     Permission created = rolePermissionService.createPermission(somePermission);
 
-    Permission createdFromDB = permissionRepository.findOne(created.getId());
+    Permission createdFromDB = permissionRepository.findById(created.getId()).orElse(null);
 
     assertEquals(somePermissionType, createdFromDB.getPermissionType());
     assertEquals(someTargetId, createdFromDB.getTargetId());
@@ -103,7 +103,7 @@ public class RolePermissionServiceTest extends AbstractIntegrationTest {
         FluentIterable.from(created).transform(BaseEntity::getId)
             .toSet();
 
-    Iterable<Permission> permissionsFromDB = permissionRepository.findAll(permissionIds);
+    Iterable<Permission> permissionsFromDB = permissionRepository.findAllById(permissionIds);
 
     Set<String> targetIds = Sets.newHashSet();
     Set<String> permissionTypes = Sets.newHashSet();
@@ -145,7 +145,7 @@ public class RolePermissionServiceTest extends AbstractIntegrationTest {
 
     Role created = rolePermissionService.createRoleWithPermissions(role, permissionIds);
 
-    Role createdFromDB = roleRepository.findOne(created.getId());
+    Role createdFromDB = roleRepository.findById(created.getId()).orElse(null);
     List<RolePermission> rolePermissions =
         rolePermissionRepository.findByRoleIdIn(Sets.newHashSet(createdFromDB.getId()));
 

+ 1 - 1
apollo-portal/src/test/resources/application.properties

@@ -1,5 +1,5 @@
 spring.datasource.url = jdbc:h2:mem:~/apolloportaldb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1
-spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
+spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true

+ 0 - 7
apollo-portal/src/test/resources/application.yml

@@ -14,14 +14,7 @@ apollo:
   portal:
     envs: local
 
-    
-endpoints:
-  health:
-    sensitive: false
-
 management:
-  security:
-    enabled: false
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

+ 21 - 8
pom.xml

@@ -75,8 +75,9 @@
 	<properties>
 		<java.version>1.8</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<spring-boot.version>1.3.8.RELEASE</spring-boot.version>
-		<spring-cloud.version>1.2.3.RELEASE</spring-cloud.version>
+		<platform-bom.version>Cairo-SR4</platform-bom.version>
+		<spring-boot.version>2.0.5.RELEASE</spring-boot.version>
+		<spring-cloud.version>Finchley.SR1</spring-cloud.version>
 		<!-- Plugins Version -->
 		<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
 		<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
@@ -287,18 +288,24 @@
 				<artifactId>h2</artifactId>
 				<version>1.4.191</version>
 			</dependency>
+			<!-- stick with mockito 1.x -->
+			<dependency>
+				<groupId>org.mockito</groupId>
+				<artifactId>mockito-core</artifactId>
+				<version>1.10.19</version>
+			</dependency>
 			<!-- declare Spring BOMs in order -->
 			<dependency>
 				<groupId>io.spring.platform</groupId>
 				<artifactId>platform-bom</artifactId>
-				<version>2.0.8.RELEASE</version>
+				<version>${platform-bom.version}</version>
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
 			<dependency>
 				<groupId>org.springframework.cloud</groupId>
-				<artifactId>spring-cloud-netflix</artifactId>
-				<version>1.2.3.RELEASE</version>
+				<artifactId>spring-cloud-dependencies</artifactId>
+				<version>${spring-cloud.version}</version>
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
@@ -323,6 +330,12 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>
 			<scope>test</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>spring-boot-starter</artifactId>
+					<groupId>org.springframework.boot</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 	</dependencies>
 
@@ -421,7 +434,7 @@
 				<plugin>
 					<groupId>org.springframework.boot</groupId>
 					<artifactId>spring-boot-maven-plugin</artifactId>
-					<version>1.3.5.RELEASE</version>
+					<version>1.3.8.RELEASE</version>
 					<executions>
 						<execution>
 							<goals>
@@ -655,7 +668,7 @@
 					<!-- eureka -->
 					<dependency>
 						<groupId>org.springframework.cloud</groupId>
-						<artifactId>spring-cloud-starter-eureka</artifactId>
+						<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
 						<version>${spring-cloud.version}</version>
 						<exclusions>
 							<!-- already in java -->
@@ -761,7 +774,7 @@
 					<!-- eureka -->
 					<dependency>
 						<groupId>org.springframework.cloud</groupId>
-						<artifactId>spring-cloud-starter-eureka</artifactId>
+						<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
 						<version>${spring-cloud.version}</version>
 						<exclusions>
 							<!-- already in java -->