Repository: ctripcorp/apollo (java)

Issue:
是否能考虑一下升级依赖的 spring-boot 版本？
我尝试着给 apollo-portal 添加 oauth2 登录功能，但是发现 apollo 使用的 spring-boot 版本太低了，没有 spring-boot-starter-oauth2-client 这个依赖。  
现在 spring-boot 2.1.x 都已经停止维护了，apollo 却还在用 2.0.5，是不是可以考虑升级一下依赖的 spring-boot 的版本呢？

Pull request description:
upgrade spring-boot to 2.4.2 and spring-cloud to 2020.0.1
## What's the purpose of this PR

upgrade spring-boot and spring-cloud to latest releases

## Which issue(s) this PR fixes:
Fixes #3485 #3504

## Brief changelog

upgrade spring-boot to 2.4.2 and spring-cloud to 2020.0.1

Follow this checklist to help us incorporate your contribution quickly and easily:

- [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Write necessary unit tests to verify the code.
- [x] Run `mvn clean test` to make sure this pull request doesn't break anything.


Patch:
diff --git a/apollo-adminservice/pom.xml b/apollo-adminservice/pom.xml
index 1c51e3e03..a44adc60a 100644
--- a/apollo-adminservice/pom.xml
+++ b/apollo-adminservice/pom.xml
@@ -59,6 +59,11 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey.contribs</groupId>
+			<artifactId>jersey-apache-client4</artifactId>
+			<scope>test</scope>
+		</dependency>
 		<dependency>
 			<groupId>com.h2database</groupId>
 			<artifactId>h2</artifactId>
diff --git a/apollo-adminservice/src/main/resources/adminservice.properties b/apollo-adminservice/src/main/resources/adminservice.properties
index aa76a5db7..cc00396f8 100644
--- a/apollo-adminservice/src/main/resources/adminservice.properties
+++ b/apollo-adminservice/src/main/resources/adminservice.properties
@@ -2,5 +2,5 @@
 spring.application.name= apollo-adminservice
 ctrip.appid= 100003172
 server.port= 8090
-logging.file= /opt/logs/100003172/apollo-adminservice.log
+logging.file.name= /opt/logs/100003172/apollo-adminservice.log
 spring.jmx.default-domain = apollo-adminservice
diff --git a/apollo-adminservice/src/main/resources/application.yml b/apollo-adminservice/src/main/resources/application.yml
index 3d0a8732d..ff5df0d7d 100644
--- a/apollo-adminservice/src/main/resources/application.yml
+++ b/apollo-adminservice/src/main/resources/application.yml
@@ -9,6 +9,27 @@ ctrip:
   
 server:
   port: 8090
-  
+
 logging:
-  file: /opt/logs/100003172/apollo-adminservice.log
+  file:
+    name: /opt/logs/100003172/apollo-adminservice.log
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  client:
+    serviceUrl:
+      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
+      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
+      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
+    healthcheck:
+      enabled: true
+    eurekaServiceUrlPollIntervalSeconds: 60
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
diff --git a/apollo-adminservice/src/main/resources/bootstrap.yml b/apollo-adminservice/src/main/resources/bootstrap.yml
deleted file mode 100644
index 05bc2467d..000000000
--- a/apollo-adminservice/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-eureka:
-  instance:
-    hostname: ${hostname:localhost}
-    preferIpAddress: true
-    status-page-url-path: /info
-    health-check-url-path: /health
-  client:
-    serviceUrl:
-      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
-      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
-      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
-    healthcheck:
-      enabled: true
-    eurekaServiceUrlPollIntervalSeconds: 60
-
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 
diff --git a/apollo-adminservice/src/main/scripts/startup.sh b/apollo-adminservice/src/main/scripts/startup.sh
index 61c4d4e86..f77e6ab5c 100644
--- a/apollo-adminservice/src/main/scripts/startup.sh
+++ b/apollo-adminservice/src/main/scripts/startup.sh
@@ -24,7 +24,7 @@ then
     export SPRING_DATASOURCE_USERNAME=$DS_USERNAME
     export SPRING_DATASOURCE_PASSWORD=$DS_PASSWORD
 fi
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 export APP_NAME=$SERVICE_NAME
 
 PATH_TO_JAR=$SERVICE_NAME".jar"
diff --git a/apollo-assembly/src/main/resources/application.yml b/apollo-assembly/src/main/resources/application.yml
index 0a8c46bfe..9cb7f44ce 100644
--- a/apollo-assembly/src/main/resources/application.yml
+++ b/apollo-assembly/src/main/resources/application.yml
@@ -3,4 +3,30 @@ spring:
     active: ${apollo_profile}
 
 logging:
-  file: /opt/logs/100003171/apollo-assembly.log
+  file:
+    name: /opt/logs/100003171/apollo-assembly.log
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
+    ldap:
+      enabled: false
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  server:
+    peerEurekaNodesUpdateIntervalMs: 60000
+    enableSelfPreservation: false
+  client:
+    serviceUrl:
+      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
+      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
+      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
+    healthcheck:
+      enabled: true
+    eurekaServiceUrlPollIntervalSeconds: 60
diff --git a/apollo-common/pom.xml b/apollo-common/pom.xml
index a6aacbb73..435cd4207 100644
--- a/apollo-common/pom.xml
+++ b/apollo-common/pom.xml
@@ -26,6 +26,10 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-security</artifactId>
diff --git a/apollo-common/src/main/resources/application.properties b/apollo-common/src/main/resources/application.properties
index c972bc263..64be37f64 100644
--- a/apollo-common/src/main/resources/application.properties
+++ b/apollo-common/src/main/resources/application.properties
@@ -1,4 +1,4 @@
-spring.http.converters.preferred-json-mapper=gson
+spring.mvc.converters.preferred-json-mapper=gson
 
 # DataSource
 spring.datasource.hikari.connectionInitSql=set names utf8mb4
@@ -14,10 +14,10 @@ server.tomcat.accept-count=5000
 # Increase tomcat header size for longer GET query parameter, should be n * 1024
 server.max-http-header-size=10240
 
-# Spring Boot 2.0
+# Spring Boot 2.x
 management.endpoints.web.base-path=/
-logging.file.max-size=50MB
-logging.file.max-history=10
+logging.logback.rollingpolicy.max-file-size=50MB
+logging.logback.rollingpolicy.max-history=10
 
 management.endpoints.web.exposure.include=info,health,metrics,prometheus
 
diff --git a/apollo-configservice/pom.xml b/apollo-configservice/pom.xml
index b31c2a1d3..297574cee 100644
--- a/apollo-configservice/pom.xml
+++ b/apollo-configservice/pom.xml
@@ -64,6 +64,10 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey.contribs</groupId>
+			<artifactId>jersey-apache-client4</artifactId>
+		</dependency>
 		<!-- end of eureka -->
 		<dependency>
 			<groupId>com.alibaba.nacos</groupId>
diff --git a/apollo-configservice/src/main/resources/application.yml b/apollo-configservice/src/main/resources/application.yml
index ee5589070..aecb367c3 100644
--- a/apollo-configservice/src/main/resources/application.yml
+++ b/apollo-configservice/src/main/resources/application.yml
@@ -11,4 +11,28 @@ server:
   port: 8080
 
 logging:
-  file: /opt/logs/100003171/apollo-configservice.log
+  file:
+    name: /opt/logs/100003171/apollo-configservice.log
+
+eureka:
+  instance:
+    hostname: ${hostname:localhost}
+    preferIpAddress: true
+    status-page-url-path: /info
+    health-check-url-path: /health
+  server:
+    peerEurekaNodesUpdateIntervalMs: 60000
+    enableSelfPreservation: false
+  client:
+    serviceUrl:
+      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
+      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
+      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
+    healthcheck:
+      enabled: true
+    eurekaServiceUrlPollIntervalSeconds: 60
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
diff --git a/apollo-configservice/src/main/resources/bootstrap.yml b/apollo-configservice/src/main/resources/bootstrap.yml
deleted file mode 100644
index 19efd32fb..000000000
--- a/apollo-configservice/src/main/resources/bootstrap.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-eureka:
-  instance:
-    hostname: ${hostname:localhost}
-    preferIpAddress: true
-    status-page-url-path: /info
-    health-check-url-path: /health
-  server:
-    peerEurekaNodesUpdateIntervalMs: 60000
-    enableSelfPreservation: false
-  client:
-    serviceUrl:
-      # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property
-      # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig
-      defaultZone: http://${eureka.instance.hostname}:8080/eureka/
-    healthcheck:
-      enabled: true
-    eurekaServiceUrlPollIntervalSeconds: 60
-
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
diff --git a/apollo-configservice/src/main/resources/configservice.properties b/apollo-configservice/src/main/resources/configservice.properties
index fbaa9cb2d..bda9b5470 100644
--- a/apollo-configservice/src/main/resources/configservice.properties
+++ b/apollo-configservice/src/main/resources/configservice.properties
@@ -2,5 +2,5 @@
 spring.application.name= apollo-configservice
 ctrip.appid= 100003171
 server.port= 8080
-logging.file= /opt/logs/100003171/apollo-configservice.log
+logging.file.name= /opt/logs/100003171/apollo-configservice.log
 spring.jmx.default-domain = apollo-configservice
diff --git a/apollo-configservice/src/main/scripts/startup.sh b/apollo-configservice/src/main/scripts/startup.sh
index 38970d330..baebb9ea1 100644
--- a/apollo-configservice/src/main/scripts/startup.sh
+++ b/apollo-configservice/src/main/scripts/startup.sh
@@ -24,7 +24,7 @@ then
     export SPRING_DATASOURCE_USERNAME=$DS_USERNAME
     export SPRING_DATASOURCE_PASSWORD=$DS_PASSWORD
 fi
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 export APP_NAME=$SERVICE_NAME
 
 PATH_TO_JAR=$SERVICE_NAME".jar"
diff --git a/apollo-portal/src/main/resources/application.yml b/apollo-portal/src/main/resources/application.yml
index 608871ba7..5b5653b96 100644
--- a/apollo-portal/src/main/resources/application.yml
+++ b/apollo-portal/src/main/resources/application.yml
@@ -17,11 +17,12 @@ server:
     use-relative-redirects: true
 
 logging:
-  file: /opt/logs/100003173/apollo-portal.log
+  file:
+    name: /opt/logs/100003173/apollo-portal.log
 
 management:
   health:
     status:
       order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
-
-
+    ldap:
+      enabled: false # disable ldap health check by default
diff --git a/apollo-portal/src/main/scripts/startup.sh b/apollo-portal/src/main/scripts/startup.sh
index 3f9799cb3..fdd9c7ed8 100755
--- a/apollo-portal/src/main/scripts/startup.sh
+++ b/apollo-portal/src/main/scripts/startup.sh
@@ -24,7 +24,7 @@ then
     export SPRING_DATASOURCE_USERNAME=$DS_USERNAME
     export SPRING_DATASOURCE_PASSWORD=$DS_PASSWORD
 fi
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 export APP_NAME=$SERVICE_NAME
 
 PATH_TO_JAR=$SERVICE_NAME".jar"
diff --git a/docs/zh/development/apollo-development-guide.md b/docs/zh/development/apollo-development-guide.md
index aadad7153..20881450e 100644
--- a/docs/zh/development/apollo-development-guide.md
+++ b/docs/zh/development/apollo-development-guide.md
@@ -46,9 +46,9 @@ Apollo本地开发需要以下组件：
 
 >注1：spring.datasource相关配置替换成你自己的数据库连接信息，注意数据库是`ApolloConfigDB`
 >
->注2：程序默认日志输出为/opt/logs/100003171/apollo-assembly.log，如果需要修改日志文件路径，可以增加`logging.file`参数，如下：
+>注2：程序默认日志输出为/opt/logs/100003171/apollo-assembly.log，如果需要修改日志文件路径，可以增加`logging.file.name`参数，如下：
 >
->-Dlogging.file=/your-path/apollo-assembly.log
+>-Dlogging.file.name=/your-path/apollo-assembly.log
 
 ### 2.1.4 Program arguments配置
 `--configservice --adminservice`
@@ -92,9 +92,9 @@ Apollo本地开发需要以下组件：
 >
 >注4：这里指定了server.port=8070是因为`apollo-configservice`启动在8080端口，所以这里配置`apollo-portal`启动在8070端口。
 >
->注5：程序默认日志输出为/opt/logs/100003173/apollo-portal.log，如果需要修改日志文件路径，可以增加`logging.file`参数，如下：
+>注5：程序默认日志输出为/opt/logs/100003173/apollo-portal.log，如果需要修改日志文件路径，可以增加`logging.file.name`参数，如下：
 >
->-Dlogging.file=/your-path/apollo-portal.log
+>-Dlogging.file.name=/your-path/apollo-portal.log
 
 ### 2.2.4 运行
 对新建的运行配置点击Run或Debug皆可。
diff --git a/pom.xml b/pom.xml
index 2a0d75d30..33758cee3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,9 +76,8 @@
 		<revision>1.8.0-SNAPSHOT</revision>
 		<java.version>1.8</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<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>
+		<spring-boot.version>2.4.2</spring-boot.version>
+		<spring-cloud.version>2020.0.1</spring-cloud.version>
 		<jaxb.version>2.3.0</jaxb.version>
 		<javax.activation.version>1.1.1</javax.activation.version>
 		<javax.mail.version>1.6.2</javax.mail.version>
@@ -289,6 +288,11 @@
 				<artifactId>guice</artifactId>
 				<version>4.1.0</version>
 			</dependency>
+			<dependency>
+				<groupId>commons-lang</groupId>
+				<artifactId>commons-lang</artifactId>
+				<version>2.6</version>
+			</dependency>
 			<!--for test -->
 			<dependency>
 				<groupId>com.h2database</groupId>
@@ -302,11 +306,17 @@
 				<version>4.0.3</version>
 				<scope>test</scope>
 			</dependency>
+			<dependency>
+				<groupId>org.junit.vintage</groupId>
+				<artifactId>junit-vintage-engine</artifactId>
+				<version>5.7.0</version>
+				<scope>test</scope>
+			</dependency>
 			<!-- declare Spring BOMs in order -->
 			<dependency>
-				<groupId>io.spring.platform</groupId>
-				<artifactId>platform-bom</artifactId>
-				<version>${platform-bom.version}</version>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-dependencies</artifactId>
+				<version>${spring-boot.version}</version>
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
@@ -317,6 +327,12 @@
 				<type>pom</type>
 				<scope>import</scope>
 			</dependency>
+			<!-- required by eureka -->
+			<dependency>
+				<groupId>com.sun.jersey.contribs</groupId>
+				<artifactId>jersey-apache-client4</artifactId>
+				<version>1.19.4</version>
+			</dependency>
 			<!-- ctrip modified -->
 			<!-- removed duplicated javax/persistence classes -->
 			<dependency>
@@ -383,6 +399,18 @@
 			<artifactId>awaitility</artifactId>
 			<scope>test</scope>
 		</dependency>
+		<!-- for junit 4 -->
+		<dependency>
+			<groupId>org.junit.vintage</groupId>
+			<artifactId>junit-vintage-engine</artifactId>
+			<scope>test</scope>
+			<exclusions>
+				<exclusion>
+					<groupId>org.hamcrest</groupId>
+					<artifactId>hamcrest-core</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
 	</dependencies>
 
 	<build>
diff --git a/scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh b/scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh
index 20336e186..858f0925a 100755
--- a/scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh
+++ b/scripts/apollo-on-kubernetes/apollo-admin-server/scripts/startup-kubernetes.sh
@@ -16,7 +16,7 @@ SERVER_URL="http://${APOLLO_ADMIN_SERVICE_NAME}:${SERVER_PORT}"
 
 ########### The following is the same for configservice, adminservice, portal ###########
 export JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 
 # Find Java
 if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
diff --git a/scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh b/scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh
index 0ec1e9a32..94accb4b7 100755
--- a/scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh
+++ b/scripts/apollo-on-kubernetes/apollo-config-server/scripts/startup-kubernetes.sh
@@ -15,7 +15,7 @@ SERVER_URL="http://${APOLLO_CONFIG_SERVICE_NAME}:${SERVER_PORT}"
 
 ########### The following is the same for configservice, adminservice, portal ###########
 export JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 
 # Find Java
 if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
diff --git a/scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh b/scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh
index ec773b431..e32e5aae8 100755
--- a/scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh
+++ b/scripts/apollo-on-kubernetes/apollo-portal-server/scripts/startup-kubernetes.sh
@@ -16,7 +16,7 @@ SERVER_URL="http://${APOLLO_PORTAL_SERVICE_NAME}:${SERVER_PORT}"
 
 ########### The following is the same for configservice, adminservice, portal ###########
 export JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+ExplicitGCInvokesConcurrent -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
-export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
+export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file.name=$LOG_DIR/$SERVICE_NAME.log -XX:HeapDumpPath=$LOG_DIR/HeapDumpOnOutOfMemoryError/"
 
 # Find Java
 if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then


Test patch:
diff --git a/apollo-adminservice/src/test/resources/application.properties b/apollo-adminservice/src/test/resources/application.properties
index bc7996de8..793e2b70b 100644
--- a/apollo-adminservice/src/test/resources/application.properties
+++ b/apollo-adminservice/src/test/resources/application.properties
@@ -3,4 +3,4 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true
-
+spring.main.allow-bean-definition-overriding=true
diff --git a/apollo-adminservice/src/test/resources/application.yml b/apollo-adminservice/src/test/resources/application.yml
index dc8ace4b4..e0ee66833 100644
--- a/apollo-adminservice/src/test/resources/application.yml
+++ b/apollo-adminservice/src/test/resources/application.yml
@@ -8,7 +8,25 @@ server:
 logging:
   level:
     org.springframework.cloud: 'DEBUG'
-  file: /opt/logs/${ctrip.appid}/apollo-adminservice.log
+  file:
+    name: /opt/logs/${ctrip.appid}/apollo-adminservice.log
 
 ctrip:
   appid: 100003172
+
+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
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
diff --git a/apollo-adminservice/src/test/resources/bootstrap.yml b/apollo-adminservice/src/test/resources/bootstrap.yml
deleted file mode 100644
index 82a6d0500..000000000
--- a/apollo-adminservice/src/test/resources/bootstrap.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-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
-      
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 
diff --git a/apollo-configservice/src/test/resources/application.properties b/apollo-configservice/src/test/resources/application.properties
index 8b77455fb..959445d31 100644
--- a/apollo-configservice/src/test/resources/application.properties
+++ b/apollo-configservice/src/test/resources/application.properties
@@ -4,5 +4,7 @@ spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true
 spring.jpa.properties.hibernate.show_sql=false
 
+spring.main.allow-bean-definition-overriding=true
+
 # for ReleaseMessageScanner test
 apollo.message-scan.interval=100
diff --git a/apollo-configservice/src/test/resources/application.yml b/apollo-configservice/src/test/resources/application.yml
index 405fe3057..9c6a49294 100644
--- a/apollo-configservice/src/test/resources/application.yml
+++ b/apollo-configservice/src/test/resources/application.yml
@@ -8,7 +8,25 @@ server:
 logging:
   level:
     org.springframework.cloud: 'DEBUG'
-  file: /opt/logs/${ctrip.appid}/apollo-configservice.log
+  file:
+    name: /opt/logs/${ctrip.appid}/apollo-configservice.log
 
 ctrip:
-  appid: 100003171
\ No newline at end of file
+  appid: 100003171
+
+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
+
+management:
+  health:
+    status:
+      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
diff --git a/apollo-configservice/src/test/resources/bootstrap.yml b/apollo-configservice/src/test/resources/bootstrap.yml
deleted file mode 100644
index 767874bb5..000000000
--- a/apollo-configservice/src/test/resources/bootstrap.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-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
-      
-management:
-  health:
-    status:
-      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 
diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/ItemControllerTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/ItemControllerTest.java
index 05f934cb9..a9ad4a04c 100644
--- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/ItemControllerTest.java
+++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/ItemControllerTest.java
@@ -17,6 +17,7 @@ import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.yaml.snakeyaml.constructor.ConstructorException;
+import org.yaml.snakeyaml.constructor.DuplicateKeyException;
 
 @RunWith(MockitoJUnitRunner.class)
 public class ItemControllerTest {
@@ -46,7 +47,7 @@ public class ItemControllerTest {
     itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml));
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test(expected = DuplicateKeyException.class)
   public void yamlSyntaxCheckWithDuplicatedValue() throws Exception {
     String yaml = loadYaml("case2.yaml");
 
diff --git a/apollo-portal/src/test/resources/application.properties b/apollo-portal/src/test/resources/application.properties
index 12daa20d4..03df637c9 100644
--- a/apollo-portal/src/test/resources/application.properties
+++ b/apollo-portal/src/test/resources/application.properties
@@ -3,3 +3,4 @@ spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.Ph
 spring.jpa.properties.hibernate.show_sql=false
 spring.h2.console.enabled = true
 spring.h2.console.settings.web-allow-others=true
+spring.main.allow-bean-definition-overriding=true
diff --git a/apollo-portal/src/test/resources/application.yml b/apollo-portal/src/test/resources/application.yml
index 8f424b220..8cad5a25f 100644
--- a/apollo-portal/src/test/resources/application.yml
+++ b/apollo-portal/src/test/resources/application.yml
@@ -8,8 +8,9 @@ spring:
 logging:
   level:
     org.springframework.cloud: 'DEBUG'
-  file: /opt/logs/100003173/apollo-portal.log
-  
+  file:
+    name: /opt/logs/100003173/apollo-portal.log
+
 apollo:
   portal:
     envs: local