This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

TypeMisMatch Exception for AOP-proxied class

Mar 27th, 2008, 08:03 PM

I've had no problem implementing AOP on any of the new service classes I'm doing active development on, which have been referenced by controllers. However, I'm trying to implement AOP on a service-layer class that has been in the codebase for some time, and a controller in the action-servlet causes a TypeMisMatch exception when trying to reference it

Your 'FamilyTravelersController' is not programmed to interfaces it uses a reference to the 'com.website.package.service.impl.ReviewService' whereas it should use the 'com.website.package.service.IReviewService'.

The proxy is an instance of your interface not of your concrete class.

That is also clearly stated by your exception.

Just as a side note, I would declare your target as an anonymous inner bean, that way you cannot reference the unproxied instance.

Comment

Thanks for the help. I had implemented your fix to no avail, but then decided to take a look at what my controller was expecting to receive, and it seems I had foolishly set it to take in the Implemented class, not the interface. Works great now, Thanks Again!