Max Ishchenko
Aug 8th, 2007, 11:53 AM
These resolvers know about application's main context. They set it as parent in their initFactory methods.
That is not very cool for me, as I have some controllers that are mapped in SimpleUrlHandlerMapping, and their ids often coincide with their view names.
We use Groovy for controllers, and can use neither name attribute, nor slashes in ids, so we use flat ids for controllers and a big mapping for SimpleUrlHandlerMapping.
So, XmlViewResolver gets a viewName, and it coincides with the controller's id, and we get BeanNotOfRequiredTypeException, as this bean is a Controller, not a View.
One of the solutions is to rename controller's beans, e.g. controller_auth instead of auth, and map them accordingly. But I'm not glad about it, as I'm going to write a COC handlermapping that will resolve bean's ids as url patterns according to some rules. For example, as I can't use slashes in ids, they can be dots, and asterisks can be underscores. That can look a bit ugly, but I lack scripted bean "name" attribute so much.
What can solve the problem without renaming tons of controllers?
I was about to post a Jira issue on adding the "noParentContext" property to the resolvers in question, but changed my mind :)
That is not very cool for me, as I have some controllers that are mapped in SimpleUrlHandlerMapping, and their ids often coincide with their view names.
We use Groovy for controllers, and can use neither name attribute, nor slashes in ids, so we use flat ids for controllers and a big mapping for SimpleUrlHandlerMapping.
So, XmlViewResolver gets a viewName, and it coincides with the controller's id, and we get BeanNotOfRequiredTypeException, as this bean is a Controller, not a View.
One of the solutions is to rename controller's beans, e.g. controller_auth instead of auth, and map them accordingly. But I'm not glad about it, as I'm going to write a COC handlermapping that will resolve bean's ids as url patterns according to some rules. For example, as I can't use slashes in ids, they can be dots, and asterisks can be underscores. That can look a bit ugly, but I lack scripted bean "name" attribute so much.
What can solve the problem without renaming tons of controllers?
I was about to post a Jira issue on adding the "noParentContext" property to the resolvers in question, but changed my mind :)