官方指南
pom文件修改
-
choerodon-framework-parent
升级为0.9.0.RELEASE
-
choerodon.starters.version
升级为0.10.0.RELEASE
-
spring-cloud-starter-eureka
=>spring-cloud-starter-netflix-eureka-client
-
spring-cloud-starter-zuul
=>spring-cloud-starter-netflix-zuul
-
spring-cloud-starter-feign
=>spring-cloud-starter-openfeign
-
spring-cloud-starter-eureka-server
=>spring-cloud-starter-netflix-eureka-server
单元测试
单元测试报如下:
java.lang.IllegalStateException: Failed to transform class with name io.choerodon.iam.app.service.impl.AccessTokenServiceImplSpec. Reason: null
...
Caused by: java.util.ConcurrentModificationException
...
或者
java.lang.IllegalStateException: Failed to load ApplicationContext
...
Caused by: java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
...
Caused by: java.lang.NoClassDefFoundError: org/mockito/cglib/proxy/MethodInterceptor
...
Caused by: java.lang.ClassNotFoundException: org.mockito.cglib.proxy.MethodInterceptor
解决方法:
-
powermock.version
1.7.4
=>2.0.0-beta.5
-
powermock-api-mockito
=>powermock-api-mockito2
- 添加指定版本javassist
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.24.0-GA</version>
</dependency>
如果单元测试里有自己mock的DiscoveryClient
,需要在application-test.yml
文件中将Spring boot 2.0自动注入的几个DiscoveryClient
排除掉,否则会报primary bean冲突的问题
spring:
autoconfigure:
exclude:
- org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration
- org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration
- org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration
- org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientAutoConfiguration
- org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration
配置修改
-
spring.http.multipart
=>spring.servlet.multipart
-
management.port
=>management.server.port
- 许多
server.*
属性 ( Servlet 特有的) 已经转移到server.servlet.*
, 比如server.context-path
-->server.servlet.context-path
-
security.ignored
被移除,使用代码替代@Value("${security.ignored:/choerodon/**")
-
management.security.*
去除,默认只有端点/health
和/info
是暴露的,开放所有端点可以使用management.endpoints.web.exposure.include=*
-
endpoints.<id>.enabled
修改为management.endpoint.<id>.enabled
chart修改
- 修改
deployment.yaml
的readinessProbe
探针,localhost:{{ .Values.deployment.managementPort }}/health
=>localhost:{{ .Values.deployment.managementPort }}/actuator/health
- 修改
values.yaml
中的metrics.path
/prometheus
=>/actuator/prometheus
导入包
-
org.springframework.cloud.netflix.feign
=>org.springframework.cloud.openfeign
-
org.springframework.boot.bind
不再可用,并被新的宽松绑定规则所取代,RelaxedDataBinder
被Binder
取代
网友评论