解决Mybatis @Mapper 接口名字冲突导致springboot程序启动不起来的问题

有两个同名的Mapper:

package com.clear.ims4.business.material.program.layout;


@Mapper
public interface LayoutRepository {
}

package com.clear.ims4.business.material.widget.layout;


@Mapper
public interface LayoutRepository {

}

一个属于program的layout,一个属于widget的layout

启动时会报错:

org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'layoutRepository' for bean class [com.clear.ims4.business.material.widget.layout.LayoutRepository] conflicts with existing, non-compatible bean definition of same name and class [com.clear.ims4.business.material.program.layout.LayoutRepository]

解决方案:

加@Repository

@Repository("ProgramLayoutRepository")

@Repository("WidgetLayoutRepository")

猜你喜欢

转载自blog.csdn.net/chunzhenzyd/article/details/84944088