This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Thanks for your attention. The IBank there is an interface. AFAIK to create a proxy bean in Spring requires an interface instead of the direct class implementation. The target property of this proxy bean requires the IBank implementation....if i am correct.
the error change to: Bean name "Bank" must be of type [arnel.nicolas.Bank], but was actually of type [$Proxy0].
I have a doubt if Spring created a bean name "Bank" of arnel.nicolas.Bank type.
Anyway thanks for your reply. I will just check their forum.
arnel nicolas
Ranch Hand
Joined: Dec 16, 2003
Posts: 149
posted
0
ok guys, i just refactored my code. It seems that there is a problem during the creation of my ProxyFactoryBean Bank. My target class TargetBank has a constructor. So values can be set thru constructor-injection via my bean config file. I removed the constructor and provide a method for it and set the values via method-injection. The code works find and it fires all my advice methods as i expected.
Now, is there a way to get the instance of a ProxyFactoryBean with constructor in the source code? like
From your original code example, try this instead:
Spring's bean factory will not return an instance of a Bank, but rather a dynamically created object that implements the IBank interface that proxies method invocations to your a Bank object.
arnel nicolas
Ranch Hand
Joined: Dec 16, 2003
Posts: 149
posted
0
Originally posted by Ryan Breidenbach: From your original code example, try this instead:
Spring's bean factory will not return an instance of a Bank, but rather a dynamically created object that implements the IBank interface that proxies method invocations to your a Bank object.
Hmm...but my concrete class Bank has a constructor that takes Object of Customer type as a parameter . I am assuming that Spring's bean factory will do create a proxy object with parameter as i have in my Target class (referring to Bank). I tried to change the code basing from your suggestion but the compiler is complaining about error. I have a doubt that the bean factory did not create a proxy bean that takes a constructor of customer type thats why i am having that error.
Here is my bean config:
arnel nicolas
Ranch Hand
Joined: Dec 16, 2003
Posts: 149
posted
0
Originally posted by Ryan Breidenbach: From your original code example, try this instead:
Spring's bean factory will not return an instance of a Bank, but rather a dynamically created object that implements the IBank interface that proxies method invocations to your a Bank object.
Hello there Mr. Breidenbach,
Discard my previous posting, you were right . I took your suggestion.The bug there is not during my invocation but it is now in my Advice method. I got it working already.
Just a comment, Spring AOP is nice and pretty straight forward but sometimes they are hard to debug