我是靠谱客的博主 呆萌外套,最近开发中收集的这篇文章主要介绍Spring CGlib Superclass has no null constructors but no arguments were given,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Spring CGlib Superclass has no null constructors but no arguments were given

 

 <bean id="beanId" class="com.bean.BeanId">

        <!--构造器参数-->

        <constructor-arg value="BeanId"/>

 

出现Superclass has no null constructors but no arguments were given异常

 

 

改成属性注入

 

 <bean id="beanId" class="com.bean.BeanId">

        <!--构造器参数-->

        <property name="name" value="BeanId"/>

 

 

或者

创建参数为空的默认构造函数。

 

 

CGlib has one important restriction: the target class must provide a default constructor.

If you use property-based injection instead of constructor-based injection, the problem will go away.

 

or

 

I just created an empty default constructor to deal with this.

 

参考:

https://stackoverflow.com/questions/15223297/superclass-has-no-null-constructors-but-no-arguments-were-given

 

最后

以上就是呆萌外套为你收集整理的Spring CGlib Superclass has no null constructors but no arguments were given的全部内容,希望文章能够帮你解决Spring CGlib Superclass has no null constructors but no arguments were given所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部