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:
java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
<aop:config>
<aop:aspect ref="indexService">
<aop:pointcut id="generateTopPoint"
expression="execution(* com.lj.cms.service.ChannelService.add*(..))||
execution(* com.lj.cms.service.ChannelService.delete*(..))||
execution(* com.lj.cms.service.ChannelService.update*(..))"/>
<aop:after method="generateTop" pointcut-ref="generateTopPoint"/>
</aop:aspect>
</aop:config>
<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>
@Autowired(required=true)
public IndexService(String ftlPath,String outPath)
{
if(util==null){
this.outPath = outPath;
util=FreemarkerUtil.getInstance(ftlPath);//ftlPath在beans.xml中配置了依赖注入,值为/ftl
}
}
上述代码原本运行时是没有错误的。
后来因为需求把 <aop:config> 的内容去掉了。
结果就一直报如上错误。
弄了半天, 最后在stackoverflow上找到原因:
http://stackoverflow.com/questions/13711347/spring-constructor-dependency-injection-issues
Classes to be proxied by CGLIB (for AOP support) must have no-args constructors.
These no-args constructors don't have to be public and it doesn't affect anything else - you can use other constructors as usually:
因此只要加入
public IndexService()
{
}
问题就解决了。
分享到:
相关推荐
Instance of Subclass, Subclass, Instance of Superclass, Superclass,及方法直接的关系
This superclass can be used to create a simple search suggestions provider for your application Source Code for Linux.
Classes Doing Work in Constructors Default Constructors Explicit Constructors Copy Constructors Structs vs. Classes Inheritance Multiple Inheritance Interfaces Operator Overloading Access Control ...
title invoke method of superclass.
invoke method of superclass Source Code for Linux.
现象: … java: 1801: method does not override a method from its superclass @Override… 原因: Eclipse is defaulting to Java... but in Java 1.5 can only be applied to methods overriding a superclass meth
3.3.3Constructors 3.3.4Methods and Messaging 3.3.5Finalizers 3.3.6Subclasses 3.3.7Java Language Interfaces 3.3.8Access Control 3.3.9Packages 3.3.10Class Variables and Class Methods ...
SuperClass是JavaScript预处理器/解释器对象,旨在促进JavaScript中基于类的OOP。 注意:项目已关闭。 替换为:http://sourceforge.net/projects/jsclass
Noa 是一个快速、小巧、精心编写的 javascript MVC 框架。 它有3个主要目标。 成为您需要的一切。 解决大型和小型应用程序存在的常见问题和陷阱。 要容易写。文档楷模活动应用程序 诺亚Noa 有0 个依赖项。 支持 IE >...
visual c++超类化实例代码superclass_注释相当全 关于超类化的一切问题这里都有答案_产生多个超类的实例.rar
The compiler provides us with a default constructor to the class having no arguments. Abstract classes We does not make a object of the abstract class. This class must be inherited. Unlike ...
class SuperClass{ int x; SuperClass( ) { x=3; System.out.println("in SuperClass : x=" +x); } void doSomething( ) { System.out.println("in SuperClass.doSomething()"); } } class ...
AboutProperty简单获取对象属性列表,键值对,superclass列表
NULL 博文链接:https://thaipine.iteye.com/blog/2354220
本篇幅内容较多,但是干货满满,不仅涉及源码分析还涉及模拟系统计算分配流程,建议分次食用,耐心看完相信会有很多收获~
解决Android studio 添加butterknife依赖,运行报错。
11.9 Extractors with One or No Arguments L2 149 11.10 The unapplySeq Method L2 149 11.11 Dynamic Invocation L2 150 Exercises 153 12 HIGHER-ORDER FUNCTIONS L1 157 12.1 Functions as Values 157 12.2 ...
EClipse:web项目中某一.jps页面忽然出现错误,鼠标点上去为:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path. 一招解决!