当前位置:首页 > 软件工具 > 开发工具 > 正文内容

MySQL使用mybatis读取json类型数据

lcpsky2年前 (2022-11-04)开发工具277

问题描述

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySqlSessionFactory' defined in class path resource [com/plat/historydatastorage/utils/ds/DynamicDataSourceRegister.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'mySqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\ajj_project\his-data-storage\target\classes\mapper\his\MeasureDataMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\ajj_project\his-data-storage\target\classes\mapper\his\MeasureDataMapper.xml]'. Cause: java.lang.IllegalStateException: No typehandler found for property valueExt

实体类属性:

private Map<String,Object> valueExt;

解决方法:

com.plat.historydatastorage.config.mybatisjava.sql.CallableStatementjava.sql.PreparedStatementjava.sql.ResultSetjava.sql.SQLExceptioncom.fasterxml.jackson.annotation.com.fasterxml.jackson.annotation.com.fasterxml.jackson.core.JsonGeneratorcom.fasterxml.jackson.databind.DeserializationFeaturecom.fasterxml.jackson.databind.ObjectMappercom.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidatororg.apache.ibatis.type.BaseTypeHandlerorg.apache.ibatis.type.JdbcTypeJsonTypeHandler<Object> BaseTypeHandler<> {
    ObjectMapper = ObjectMapper(){
        .configure(DeserializationFeature.).configure(JsonGenerator.Feature.).setDefaultPropertyInclusion(.Include.).activateDefaultTyping(
                LaissezFaireSubTypeValidator.ObjectMapper.DefaultTyping..As.)}
    Class<> (Class<> clazz) {
        (clazz == ) {IllegalArgumentException()}
        .= clazz}
    (PreparedStatement psiparameterJdbcType jdbcType) SQLException {
        ps.setString(i.toJson(parameter))}
    (ResultSet rsString columnName) SQLException {
        .toObject(rs.getString(columnName))}
    (ResultSet rscolumnIndex) SQLException {
        .toObject(rs.getString(columnIndex))}
    (CallableStatement cscolumnIndex) SQLException {
        .toObject(cs.getString(columnIndex))}
    String (object) {
        {
            .writeValueAsString(object)} (Exception e) {
            RuntimeException(e)}
    }
    (String contentClass<?> clazz) {
        (content != && !content.isEmpty()) {
            {
                () .readValue(contentclazz)} (Exception e) {
                RuntimeException(e)}
        } {
            }
    }

}


扫描二维码推送至手机访问。

版权声明:本文由软件技术记录发布,如需转载请注明出处。

本文链接:https://lcpsky.top/?id=32

分享给朋友:
返回列表

上一篇:git淘宝镜像

下一篇:JRebel工具

“MySQL使用mybatis读取json类型数据” 的相关文章

Redis开发相关软件

Redis开发相关软件

Redis最新客户端resp-2022.2.0.exe下载地址访问密码:wPydfRedis-x64-3.2.100下载地址访问密码:C6CF0...

git淘宝镜像

git版本升级。下载地址:一般下载速度比较慢,推荐使用淘宝镜像下载网址:https://npm.taobao.org/mirrors/git-for-windows/...

JRebel工具

JRebel工具

https://www.guidgen.com/...

git忽略已经管理的文件及文件夹

git rm -r -f --cached ignoreFile(ignoreFile就是你想忽略的文件),让git不再tracking这些文件。git add -Agit commit -m "msg"...