Why do you need this? In any method where you need to access the current instance, i.e. self , you just use the this .
Are we missing something? If there is anything else you are trying to do, try clarifying your question and we will take it as a hit.
If you're interested, this will not work, because a bean cannot be entered until it is completely constructed -> this means that Spring must enter all the properties of the bean. Effectively, what you did is create a circular dependency because Spring tries to instantiate the bean, and when it does, it discovers that it needs Autowire another bean. When he tries to find that the bean he cannot, because the bean has not been added to the list of initialized beans (because it is currently being initialized). Does this make sense? This is why you get a BeanNotFoundException because a bean cannot be initialized.
Chris Thompson Feb 24 '11 at 16:35 2011-02-24 16:35
source share