admin管理员组

文章数量:1794759

解决Consider defining a bean of type ‘*Mapper‘ in your configuration.

解决Consider defining a bean of type ‘*Mapper‘ in your configuration.

pom.xml

<dependency>     <groupId>org.mybatis.spring.boot</groupId>     <artifactId>mybatis-spring-boot-starter</artifactId>     <version>2.0.1</version> </dependency> 1.在Mapper接口上贴@Mapper

@Repository @Mapper public interface CommodityMapper {     /**      * 查询所有商品信      * @return List<Commodity> 所有商品信      */     List<Commodity> selectAll(); } 2.启动类上贴@MapperScan(value = "com.xiami.springboot.sbootdemo.mapper")注解,告诉Spring,Mapper接口的位置

@SpringBootApplication @MapperScan(value = "com.xiami.springboot.sbootdemo.mapper") public class SbootdemoApplication {       public static void main(String[] args) {         SpringApplication.run(SbootdemoApplication.class, args);     }   }

本文标签: beandefiningtypeconfigurationmapper