公司建设网站费用属于什么费用吗,自学做网站要多久,织梦如何做汽车贸易网站,百度网盘可以做网站吗在Spring Boot Mybatis 中#xff0c;使用Repository失效 在springboot 中#xff0c;给mapper的接口上加上Repository#xff0c;无法生成相应的bean,从而无法Autowired#xff0c;这是因为spring扫描注解时#xff0c;自动过滤掉了接口和抽象类#xff0c;这种情况下可…在Spring Boot Mybatis 中使用Repository失效 在springboot 中给mapper的接口上加上Repository无法生成相应的bean,从而无法Autowired这是因为spring扫描注解时自动过滤掉了接口和抽象类这种情况下可以在启动的类前加 上MapperScan“×××.×××.mapper”从而使mapper可以自动注入但是idea还会提示bean无法找到但是不会影响运行。如下所示 启动类上
MapperScan(basePackages {com.test.teinterface},annotationClass Mapper.class
)
public class InterfaceApplication extends SpringBootServletInitializer {public InterfaceApplication() {}public static void main(String[] args) {(new SpringApplicationBuilder(new Object[]{InterfaceApplication.class})).web(true).run(args);}protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {SpringApplicationBuilder rst builder.sources(new Class[]{InterfaceApplication.class});return rst;}
}mybatis mapper接口上
Repository
public interface TPersonBaseInfoMapper extends tk.mybatis.mapper.common.MapperTPersonBaseInfo {ListMapString, String query(String var1);Integer getCountByCid(String var1);Integer update(TPersonBaseInfo var1);
}当不加Repository注解时在service中idea会提示bean not found