项目版本升级:从升级到版本前言简单记录一次本人在自己的项目中,把版本升级到版本时升级的步骤,及遇到的问题。提升版本号更改文件中的版本号修改y文件中的部分配置在

SpringBoot项目版本升级:从1.5.3升级到2.1.8版本

简单记录一次本人在自己的SpringBoot项目project-template中,把 1.5.3 版本升级到 2.1.8 版本时升级的步骤,及遇到的问题。

提升parent版本号

更改pom文件中parent的版本号

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.8.RELEASE</version>
    <relativePath />
</parent>

修改yml文件中的部分配置

在1.5版本中,部分配置与2.1版本有些不同

应用名及上下文

1.5版本

server:
  application-display-name: ProjectTemplate-Web
  context-path: /project

2.1版本

server:
  servlet:
    application-display-name: ProjectTemplate-Web
    context-path: /project

1.5版本

spring:
  http:
    multipart:
      location: E:/dev/Project/work/project_data/projettemplate/temp/dev  #文件临时目录
      max-request-size: 40MB
      max-file-size: 40MB

2.1版本

spring:
  servlet:
    multipart:
      location: E:/dev/Project/work/project_data/projettemplate/temp/dev # 文件临时目录
      max-request-size: 40MB
      max-file-size: 40MB

mysql连接

1.5版本

spring:
   datasource: 
     url: jdbc:mysql://localhost:3306/projettemplate?useUnicode=true&useSSL=false&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT
     username: root
     password: root
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: com.mysql.cj.jdbc.Driver

2.1版本

spring:
   datasource: 
     druid:
       url: jdbc:mysql://localhost:3306/projettemplate?useUnicode=true&useSSL=false&characterEncoding=utf-8&autoReconnect=true&serverTimezone=GMT
       username: root
       password: root
       db-type: com.alibaba.druid.pool.DruidDataSource
       driver-class-name: com.mysql.cj.jdbc.Driver

redis配置

1.5版本

spring:
 redis:   # REDIS (RedisProperties)
   database: 0
   host: 127.0.0.1
   port: 6379
   timeout: 2000
   pool:
     max-active: 8
     max-wait: -1
     max-idle: 8
     min-idle: 0

2.1版本

spring:
  redis:   # REDIS (RedisProperties)
    database: 0
    host: 127.0.0.1
    port: 6379
    timeout: 2000
    jedis:
      pool:
        max-idle: 8
        max-wait: -1

启动项目遇到的问题

druid-spring-boot-starter版本过低报异常

当版本为1.1.6时,报异常:

... ...
Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
... ...
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvider
... ...
java.lang.IllegalStateException: Failed to introspect Class [com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
... ...
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/autoconfigure/jdbc/metadata/DataSourcePoolMetadataProvider
... ...
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvider

升级为1.1.10版本即可

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid-spring-boot-starter</artifactId>
    <version>1.1.10</version>
</dependency>

SpringSecurity的AuthenticationManager启动报异常

当报异常:

A component required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found

在SpringSecurity文件中重写即可

@Bean(name = BeanIds.AUTHENTICATION_MANAGER)
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();

当报以下异常:

The bean 'userDetailsServiceImpl', defined in class path resource [com/itmacy/dev/auth/security/SecurityConfig.class], could not be registered. A bean with that name has already been defined in file [/Users/chenmeixuan/macy/dev/project/study/webBack/project-template/target/project-template-1.0.0-SNAPSHOT_20200215-1336/classes/com/itmacy/dev/auth/security/UserDetailsServiceImpl.class] and overriding is disabled.

在yml文件中添加以下配置即可

spring:
   main:
     allow-bean-definition-overriding: true
项目版本升级:从升级到版本前言简单记录一次本人在自己的项目中,把版本升级到版本时升级的步骤,及遇到的问题。提升版本号更改文件中的版本号修改y文件中的部分配置在SpringBoot项目版本升级:从1.5.3升级到2.1.8版本前言简单记录一次本人在自己的SpringBoot项目project-template中,把1.5.3版本升级到2.1.8版本时升级的步骤,及遇到的问题。提升parent版本号更改pom文件中parent的版本号&lt;parent&gt; &lt;g
项目示例基于spring boot 最新版本2.1.9)实现,Spring Boot、Spring Cloud 学习示例,将持续更新…… 在基于Spring Boot、Spring Cloud 分布微服务开发过程中,根据实际项目环境,需要选择、集成符合项目需求的各种组件和积累各种解决方案。基于这样的背景下,我开源了本示例项目,方便大家快速上手Spring Boot、Spring Cloud 。 每个示例都带有详细的介绍文档、作者在使用过程中踩过的坑、解决方案及参考资料,方便快速上手为你提供学习捷径,少绕弯路,提高开发效率。 有需要写关于spring boot、spring cloud示例,可以给我提issue哦 ## 项目介绍 spring boot demo 是一个Spring Boot、Spring Cloud的项目示例,根据市场主流的后端技术,共集成了30+个demo,未来将持续更新。该项目包含helloworld(快速入门)、web(ssh项目快速搭建)、aop(切面编程)、data-redis(redis缓存)、quartz(集群任务实现)、shiro(权限管理)、oauth2(四种认证模式)、shign(接口参数防篡改重放)、encoder(用户密码设计)、actuator(服务监控)、cloud-config(配置中心)、cloud-gateway(服务网关)、email(邮件发送)、cloud-alibaba(微服务全家桶)等模块 ### 开发环境 - JDK1.8 + - Maven 3.5 + - IntelliJ IDEA ULTIMATE 2019.1 - MySql 5.7 + ### Spring Boot 模块 模块名称|主要内容 ---|--- helloworld|[spring mvc,Spring Boot项目创建,单元测试](https://github.com/smltq/spring-boot-demo/blob/master/helloworld/HELP.md) web|[ssh项目,spring mvc,过滤器,拦截器,监视器,thymeleaf,lombok,jquery,bootstrap,mysql](https://github.com/smltq/spring-boot-demo/blob/master/web/HELP.md) aop|[aop,正则,前置通知,后置通知,环绕通知](https://github.com/smltq/spring-boot-demo/blob/master/aop/HELP.md) data-redis|[lettuce,redis,session redis,YAML配置,连接池,对象存储](https://github.com/smltq/spring-boot-demo/blob/master/data-redis/HELP.md) quartz|[Spring Scheduler,Quartz,分布式调度,集群,mysql持久化等](https://github.com/smltq/spring-boot-demo/blob/master/quartz/HELP.md) shiro|[授权、认证、加解密、统一异常处理](https://github.com/smltq/spring-boot-demo/blob/master/shiro/HELP.md) sign|[防篡改、防重放、文档自动生成](https://github.com/smltq/spring-boot-demo/blob/master/sign/HELP.md) security|[授权、认证、加解密、mybatis plus使用](https://github.com/smltq/spring-boot-demo/blob/master/security/HELP.md) mybatis-plus-generator|[基于mybatisplus代码自动生成](https://github.com/smltq/spring-boot-demo/blob/master/mybatis-plus-generator) mybatis-plus-crud|[基于mybatisplus实现数据库增、册、改、查](https://github.com/smltq/spring-boot-demo/blob/master/mybatis-plus-crud) encoder|[主流加密算法介绍、用户加密算法推荐](https://github.com/smltq/spring-boot-demo/blob/master/encoder/HELP.md) actuator|[autuator介绍](https://github.com/smltq/spring-boot-demo/blob/master/actuator/README.md) admin|[可视化服务监控、使用](https://github.com/smltq/spring-boot-demo/blob/master/admin/README.md) security-oauth2-credentials|[oauth2实现密码模式、客户端模式](https://github.com/smltq/spring-boot-demo/blob/master/security-oauth2-credentials/README.md) security-oauth2-auth-code|[基于spring boot实现oauth2授权模式](https://github.com/smltq/spring-boot-demo/blob/master/security-oauth2-auth-code/README.md) mybatis-multi-datasource|[mybatis、数据库集群、读写分离、读库负载均衡](https://github.com/smltq/spring-boot-demo/blob/master/mybatis-multi-datasource) template-thymeleaf|[thymeleaf实现应用国际化示例](https://github.com/smltq/spring-boot-demo/blob/master/template-thymeleaf) mq-redis|[redis之mq实现,发布订阅模式](https://github.com/smltq/spring-boot-demo/blob/master/mq-redis) email|[email实现邮件发送](https://github.com/smltq/spring-boot-demo/blob/master/email) jGit|[java调用git命令、jgit使用等](https://github.com/smltq/spring-boot-demo/blob/master/jGit) webmagic|[webmagic实现某电影网站爬虫示例](https://github.com/smltq/spring-boot-demo/blob/master/webmagic) netty|[基于BIO、NIO等tcp服务器搭建介绍](https://github.com/smltq/spring-boot-demo/blob/master/netty) ### Spring Cloud 模块 模块名称|主要内容 ---|--- cloud-oauth2-auth-code|[基于spring cloud实现oath2授权模式](https://github.com/smltq/spring-boot-demo/blob/master/cloud-oauth2-auth-code) cloud-gateway|[API主流网关、gateway快速上手](https://github.com/smltq/spring-boot-demo/blob/master/cloud-gateway) cloud-config|[配置中心(服务端、客户端)示例](https://github.com/smltq/spring-boot-demo/blob/master/cloud-config) cloud-feign|[Eureka服务注册中心、负载均衡、声明式服务调用](https://github.com/smltq/spring-boot-demo/blob/master/cloud-feign) cloud-hystrix|[Hystrix服务容错、异常处理、注册中心示例](https://github.com/smltq/spring-boot-demo/blob/master/cloud-hystrix) cloud-zuul|[zuul服务网关、过滤器、路由转发、服务降级、负载均衡](https://github.com/smltq/spring-boot-demo/blob/master/cloud-zuul) cloud-alibaba|[nacos服务中心、配置中心、限流等使用(系列示例整理中...)](https://github.com/smltq/spring-boot-demo/blob/master/cloud-alibaba) #### Spring Cloud Alibaba 模块 模块名称|主要内容 ---|--- nacos|[Spring Cloud Alibaba(一)如何使用nacos服务注册和发现](https://github.com/smltq/spring-boot-demo/blob/master/cloud-alibaba/README1.md) config|[Spring Cloud Alibaba(二)配置中心多项目、多配置文件、分目录实现](https://github.com/smltq/spring-boot-demo/blob/master/cloud-alibaba/README2.md) Sentinel|[Spring Cloud Alibaba(三)Sentinel之熔断降级](https://github.com/smltq/spring-boot-demo/blob/master/cloud-alibaba/README3.md) Dubbo|[Spring Cloud Alibaba(四)Spring Cloud与Dubbo的融合](https://github.com/smltq/spring-boot-demo/blob/master/cloud-alibaba/README4.md) RocketMQ|[Spring Cloud Alibaba(五)RocketMQ 异步通信实现](https://github.com/smltq/spring-boot-demo/blob/master/cloud-alibaba/README5.md) ### 其它 模块名称|主要内容 ---|--- leetcode|[力扣题解目录](https://github.com/smltq/spring-boot-demo/blob/master/leetcode) ## Spring Boot 概述 Spring Boot简化了基于Spring的应用开发,通过少量的代码就能创建一个独立的、产品级别的Spring应用。 Spring Boot为Spring平台及第三方库提供开箱即用的设置,这样你就可以有条不紊地开始。多数Spring Boot应用只需要很少的Spring配置。 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Sprin
3月29日spring爆出cve-2022-22950漏洞,为修复漏洞升级至2.6.5,记录填坑程。原版本2.1.18 1、spring.profiles.active配置失效 springboot2.4之前的yml配置写法 spring: profiles: active: test springboot2.4之后的yml配置写法 spring: config: activate: on-profile: - test 2、内置tomc
项目中dubbo当前使用版本是dubbo2.7.8,由于安全要求该版本存在问题:Apache Dubbo远程代码执行漏洞(CVE-2021-30181)需要升级到2.7.10及以上。 升级过程中遇到的问题: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 14:41:07.235 [main] ERROR o.s.b
手里有个Spring Cloud的工程,是服务提供者的身份,在pom.xml中配置的Spring Cloud版本是Dalston.SR5,想要升级到Edgware.RELEASE,有一处依赖包的改动需要注意; 升级前的配置 pom.xml中和Spring Cloud相关的配置如下图所示,红框中是当前版本,绿框中是服务注册相关的starter依赖: 升级Spring Cloud版本 第一...
4,有的包在编程上的用法规则也有变。这点还没有整理清楚。虽然我升级完成。但还要整理、测试。 5,下一步就是在做 2.1.7 => 2.6.7 可能会,但不确认是不是小升点。在试。变化还是很多的。 2.1.7不具备上线条件,2.6.7以前的版本都有 BUG。
项目使用到了springcloud的oauth2依赖,直接升级springboot项目版本为最新 `2.6.8`(2022年6月16日)将会报以下错误: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata springcloud下的oauth2依赖早已停止维护,而且最新的oauth2版本不支持高版本springboot,高版本中缺少该类。我们手动创建一个即可:...
Spring Boot已经发布2.0有5个月多,多了很多新特性,一些坑也慢慢被填上,最近有空,就把项目中Spring Boot 版本做了升级,顺便整理下升级的时候遇到的一些坑,做个记录。后续的教程就以最新的2.03版本为主。参考官方文档翻译 在你开始之前 2.x 至少需要 JDK 8 的支持,2.x 里面的许多方法应用了 JDK 8 的许多...
在使用cdh-hive2.1.1版本orc格式表读取时,使用包数组可能会引发越界错误。对于这个问题,可以使用替换包来解决。具体来说,是需要使用cdh-hive2.1.1版本中的orc-core-1.5.11.jar文件来替换掉原来的orc-core-1.5.3-cdh5.7.0.jar文件。这样做的原因是,orc-core-1.5.3-cdh5.7.0.jar文件中存在着数组越界的问题,而orc-core-1.5.11.jar文件则修复了这个问题。 替换包的过程如下: 1.将orc-core-1.5.3-cdh5.7.0.jar文件从Hadoop的lib目录下移除。 2.将orc-core-1.5.11.jar文件复制到Hadoop的lib目录下。 3.重启Hadoop集群,并重新启动Hive服务。 通过替换包的方式,可以有效地解决cdh-hive2.1.1版本orc格式表读取包数组越界的问题,确保数据的正常读取和分析。
java.lang.IllegalArgumentException: No enum constant org.springframework.web.bind.annotation.Request Bridge设计模式 Adapter(Wrapper)设计模式