加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何使用Spring Hibernate配置包级别@TypeDefs

发布时间:2020-12-15 01:27:39 所属栏目:大数据 来源:网络整理
导读:我需要在包级别配置@TypeDefs以使用自定义@Type.当我按照方式配置它时,我得到ClassNotFoundException.但是当我在类级别上放置@TypeDefs时它工作正常. 我找到了类似的stackoverflow post,但我不知道如何配置 使用我的application-context.xml文件输入. 根据一

我需要在包级别配置@TypeDefs以使用自定义@Type.当我按照方式配置它时,我得到ClassNotFoundException.但是当我在类级别上放置@TypeDefs时它工作正常.

我找到了类似的stackoverflow post,但我不知道如何配置< resource package =“com.foo.bar.thepackage”/>使用我的application-context.xml文件输入.

根据一些帖子(如下文),注意到这是一个与春天相关的bug

I believe this is due to a bug in Spring,where it doesn't scan the annotations in package-info,but only those on classes annotated with @Entity,@Embeddable,or @MappedSuperclass. See https://jira.springsource.org/browse/SPR-8589.

任何人都可以帮我解决这个问题.谢谢.

带有package-info.java的@TypeDefs声明

@TypeDefs
        ({
                @TypeDef(
                        name="encryptedString",typeClass=EncryptedStringType.class,parameters={
                                @Parameter(name="encryptorRegisteredName",value="abcHibernateStringEncryptor")
                        }
                )
        })

package com.abc.core.model;

import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
import org.hibernate.annotations.Parameter;
import org.jasypt.hibernate4.type.EncryptedStringType;

应用程序的context.xml

                        

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读