Results 1 to 2 of 2

Thread: Problems after introducing CGLIB dependency

  1. #1
    Join Date
    Feb 2010
    Posts
    1

    Default Problems after introducing CGLIB dependency

    I have successfully used Spring AOP with JDK Dynamic Proxies in the Service/DAO layers of our application. I want to introduce Advice around our Controllers. However, we are using Spring MVC and annotated controllers that do not implement any interface. Therefore, I need to introduce CGLIB as a dependency in order to do this.

    My problem is that when I simply introduce CGLIB as a dependency in my project (cglib-nodep.jar) without adding any Advice then I'm encountering errors with autoboxing that did not occur before. I have a TO with a primitive int property (call it foo). A piece of code is calling the setter with an Integer variable that is null.

    Integer myNullInt = nulll;
    mySample.setFoo(myNullInt);

    We're on JDK 5 and this code ran without error before I introduced the CGLIB dependency. I know that I can fix the code...but my concern is that it seems risky to introduce CGLIB on the project given that I don't know what other error might arise when I do (with a large legacy code base).

    Has anyone run into similar problems with CGLIB?

    Is there a better solution to adding advice around Annotated Controllers using JDK Dynamic Proxies so that I can avoid using CGLIB? Is it still considered good practice to create Interfaces for Controllers? One possible route I might follow is to use HandlerInterceptors instead of SpringAOP to do what I need to do around the Controllers.

  2. #2
    Join Date
    Jun 2009
    Posts
    190

    Default

    you can try a hand on aspectJ instead of spring aop

    -Hetal

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •