我的方法在逻辑上应该在不同控制器的基本控制器类(上传图标)中。这不是特定控制器的功能。这是代码:
public abstract class BaseTabsManagementController{
...
@RequestMapping(method = RequestMethod.POST, value = "/upload_tab_icon")
public @ResponseBody Response<List<Icon>> saveIcon(@RequestParam("tabIcon") MultipartFile file,
@ModelAttribute(TAB_BEAN) AddEditTabBean tabBean) {
...
}
}
我有2个派生控制器AddEditTabController
和AddEditContentPageController
。但是当我运行代码时,我得到了以下异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Cannot map handler 'addEditTabController' to URL path [/admin/ui/upload_tab_icon]: There is already handler of type [class com.synisys.idm.analytics.designer.controller.AddEditContentPageController] mapped.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
.......
有人知道如何解决这个问题吗?