The problem with cglib is that you can't have a proxy of a proxy. Working
with interfaces always solves this problem as Spring doesn't use cglib in
that case, just plain old java proxy objects (java.lang.reflect.Proxy from
memory). Using interfaces also promotes loose coupling, a nice design goal.

-- Kim


On 15/09/2007, Tom McGee <[EMAIL PROTECTED]> wrote:
>
> I used the factory approach too. See my post from 9/5/2007 "yet
> another way to add spring to restlets, any opinions?"
>
> On 9/14/07, Adam Taft <[EMAIL PROTECTED]> wrote:
> >
> >
> > > Interesting. I'm using lookup-method in production without any
> problems.
> > > But, there are no transactions and no other proxies so I guess we got
> > > lucky. Do the clashes only occur within the class or does it cause
> > > problems everywhere? In other words, am I safe if the resource class
> is
> > > not transactional, but is uses a service class that is?
> >
> > I believe it might be limited if you're trying to make the methods in
> > the Resource class itself transactional, but I can't remember exactly.
> > It might have happened in your scenario too.
> >
> > The problem for me was that transactions which should have rolled back
> > didn't.  This is really sneaky, because I had to crank up the spring
> > logging to 'debug' in order to see the transaction output.  Then, I had
> > to throw an exception in one of my DAO methods and watch to see if the
> > transaction rolled back.
> >
> > What solved it was by not using lookup-method and instead using a
> > different factory approach to creating Resources.  This allowed me to
> > remove the CGLib dependency out of my configuration, which I personally
> > like (the fewer dependencies that rely on "magic" the better, in my
> mind).
> >
> > Adam
> >
>

Reply via email to