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
  • 相关阅读:
    【转】BP神经网络
    【转】Matlab的regionprops详解
    【转】本人常用资源整理(ing...)
    【转】LDA-linear discriminant analysis
    [转]推荐几个机器学习算法及应用领域相关的中国大牛:
    【转】机器学习资料推荐
    《转贴》机器学习 机器视觉 图像处理 牛人牛站
    [转]LLE
    UVA10651
    UVA10051
  • 原文地址:https://www.cnblogs.com/chenziyu/p/9711428.html
Copyright © 2011-2022 走看看