| Author |
getting $Proxy0 cannot be cast exception
|
sirisha mullapudi
Greenhorn
Joined: Mar 05, 2008
Posts: 8
|
|
Hi,
I have implemented BeanNameAware Interface and i am trying to access the bean using ApplicationContext.There i am getting exception $Proxy0 cannot be cast to net.springtest.SimpleBean. I am new to Spring framework.I have read that applicationcontext provides all the features that bean factory has.But here i am able to load the bean using BeanFactory but not ApplicationContext. Can you please describe what exactly proxy meant here and in what situations we should use bean factory and applicationContext. Appreciate your Help.
Regards,
Sireesha
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
You must be using some sort of AOP I think so you are getting a proxy object. Can you show us your spring configuration file...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
sirisha mullapudi
Greenhorn
Joined: Mar 05, 2008
Posts: 8
|
|
hi,please find the xml below :
Thanks,
Sireesha
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
Yes indeed you are using AOP. In that case you'll have to create a base interface of SimpleBean class and use that interface as reference when you get the simpleBean from ApplicationContext...
|
 |
 |
|
|
subject: getting $Proxy0 cannot be cast exception
|
|
|