zoukankan      html  css  js  c++  java
  • spring boot 2.x版本:java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedDataBinder

    标题 ##搭建spring boot 2.0.3版本

    使用alibaba的druid数据库连接池,com.github.pagehelper的分页插件,启动项目报错。 
    错误提示:java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedDataBinder
    boot.bind下找不到RelaxedDataBinder这个方法
    查看API发现,这个org.springframework.boot.bind 包已经删掉了,导致RelaxedPropertyResolver这个方法已经不可用了

    解决方案一:使用jdbc连接

         <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>

    附application.yml配置,建议使用yml格式配置,properties格式的配置文件有时无效果

    server:
      port: 8080
    
    spring:
        datasource:
            name: test
            url: jdbc:mysql://127.0.0.1:3306/mytest
            username: root
            password: 123456
            driver-class-name: com.mysql.jdbc.Driver
    mybatis:
      mapper-locations: classpath:mapper/*Mapper.xml
      type-aliases-package: com.example.spring_boot.bean

    解决方案二:boot版本改为1.5.x版本

    附alibaba的druid数据库连接池

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

    com.github.pagehelper分页插件

            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper-spring-boot-starter</artifactId>
                <version>1.1.2</version>
            </dependency>

    附application.yml配置

    server:
      port: 8080
    
    spring:
        datasource:
            name: test
            type: com.alibaba.druid.pool.DruidDataSource
            druid:
              driver-class-name: com.mysql.jdbc.Driver
              url: jdbc:mysql://127.0.0.1:3306/mytest
              username: root
              password: 123456
    mybatis:
      mapper-locations: classpath:mapper/*Mapper.xml
      type-aliases-package: com.example.spring_boot.bean
    
    #pagehelper
    pagehelper:
        helperDialect: mysql
        reasonable: true
        supportMethodsArguments: true
        params: count=countSql
        returnPageInfo: check
  • 相关阅读:
    Oracle select for update and for update nowait
    Oracle DML , DDL , DCL
    Shell变量的作用域:Shell全局变量、环境变量和局部变量
    Shell脚本的调试方法
    openlayers6地图全图以及框选截图导出功能(附源码下载)
    Markdown基本语法
    sql 四大排名函数---(ROW_NUMBER、RANK、DENSE_RANK、NTILE)简介
    Newtonsoft.Json 去掉
    辽宁软考报名地址
    burp suite professional安装及使用教程
  • 原文地址:https://www.cnblogs.com/chenziyu/p/9711428.html
Copyright © 2011-2022 走看看