Cocould not generate cglib subclass of class [Class X

Source: Internet
Author: User

Notes for Spring AOP configuration: cglib


When an AOP proxy class is generated, the following error occurs: cocould not generate cglib subclass of class [class XXXX]: common causes of this problem include using a final class or a non-visible class;

After checking, it was originally written in the configuration for starting AOP in spring.

1 <AOP: aspectj-autoproxy proxy-target-class = "true"/>

2 <TX: annotation-driven proxy-target-class = "true" transaction-Manager = "txmanager"/>
In this case, spring uses cglib for proxy, but this method is not applicable to interface-oriented programming. That is to say, the class to be proxy cannot implement interfaces, in addition, a default constructor is required for normal use.

To solve this problem, use the default proxy method of spring and change the configuration

1 <AOP: aspectj-autoproxy/>

2 <TX: annotation-driven transaction-Manager = "txmanager"/>

OK.


Cocould not generate cglib subclass of class [Class X

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.