当前位置:首页 > 开发 > 系统架构 > 架构 > 正文

Superclass has no null constructors but no arguments were given

发表于: 2014-01-25   作者:alleni123   来源:转载   浏览次数:
摘要: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexService' defined in file [D:\konghaoShopping\cms-web\target\classes\com\lj\cms\service\IndexService.class]:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexService' defined in file [D:\konghaoShopping\cms-web\target\classes\com\lj\cms\service\IndexService.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.lj.cms.service.IndexService]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given


Caused by:
org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.lj.cms.service.IndexService]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:217)


Caused by:
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given



这里是由于我在写service的时候自定义了一个constructor,而beans.xml中并没有配置对应的依赖注入。
spring要用无参构造函数,但是不能调用。

@Service("indexService")
public class IndexService implements IIndexService{
@Autowired(required=true)
	public IndexService(String ftlPath,String outPath)
	{
		super();
		this.ftlPath=ftlPath;
		this.outPath = outPath;
		
	}
}


解决方法只要在beans.xml中配置一下对应的依赖注入即可:

<bean id="ftlPath" class="java.lang.String">
		<constructor-arg value="/ftl"></constructor-arg>
	</bean>

<bean id="outPath" class="java.lang.String">
		<constructor-arg value="/jsp/template"></constructor-arg>
	</bean>

Superclass has no null constructors but no arguments were given

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

编辑推荐
在自己做机房收费系统的过程中出现了这样的一个现象:如图 str1 下面出现了一行波浪线.同时提醒自己
在自己做机房收费系统的过程中出现了这样的一个现象:如图 str1 下面出现了一行波浪线.同时提醒自己
在自己做机房收费系统的过程中出现了这样的一个现象:如图 str1 下面出现了一行波浪线.同时提醒自己
Have you ever faced a situation where you wanted to modify your existing table and was bugged
If I Were Yo选自Tamia2000年发行的专辑《A nu day》 歌曲中一句歌一滴水,歌声水声那样完美的切合
看了第三章前半部分extend作者实现的superclass() 部分,不知道为何在分析extjs源码中途要创造这样
Eclipse 中 program arguments 与 VM arguments 的区别 附代码: public static void main(String[]
今天用控制台新建了一个Maven工程。用eclipse导入这个工程后,index.jsp报了这个错误: The supercl
完整错误信息: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND
转自:http://blog.csdn.net/testcs_dn/article/details/36455669 完整错误信息: THIS SOFTWARE IS
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号