Hello all!
It's my first post at this forum, so I'd like to welcome everyone
Currently we are developing kind-of addon/plugin functionality for our system based on Spring 3.1. One of its function would be the possibility to override existing controller with another one with the same request mapping. So for example we have:
and in the addon we would like to have:Code:@Controller @RequestMapping(value = "/login") public class LoginPageController extends AbstractLoginPageController { @RequestMapping(method = RequestMethod.GET) public String doLogin(final HttpServletRequest request, final HttpServletResponse response, final HttpSession session) { ... } }
Is there any way to achieve it? Currently all my efforts ends with ambiguous mapping error:Code:@Controller @RequestMapping(value = "/login") public class AddonLoginPageController { @RequestMapping(method = RequestMethod.GET) public String doLogin(final HttpServletRequest request, final HttpServletResponse response, final HttpSession session) { ... } }
I think one approach could be to override the mapping, another to override the actual controller bean, but have not succeeded yetCode:ERROR [WrapperSimpleAppMain] [ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestM appingHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'de.h ybris.platform.addons.addtld.controllers.AddonLoginPageController#0' bean method public java.lang.String de.hybris.platform.addons.addtld.controllers.AddonLoginPageController.doLogin(java.lang.String,boolean,org.springframework.ui. Model,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpSession) to {[/login],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'loginPageController' bean method public java.lang.String de.hybris.platform.yacceleratorstorefront.controllers.pages.LoginPageController.doLogin(java.lang.String,boolean,org.springfra mework.ui.Model,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpSession) throws de.hybris.platform .cms2.exceptions.CMSItemNotFoundException mapped.
Thanks in advance for any ideas!




Reply With Quote