Choerodon Spring Boot 1.5.x迁移2.0

2019-03-27  本文已影响0人  superlee01

官方指南

spring boot 2.0 升级指南

Spring Boot Security 2.0升级指南

pom文件修改

单元测试

单元测试报如下:

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
解决方法:
        <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

配置修改

chart修改

导入包

上一篇 下一篇

猜你喜欢

热点阅读