Consider defining a bean of type 'com.xxx.item.mapper.BrandMapper' in your configuration.报错解决办法

提示Mapper里面报错,那说明是mapper找不到,扫描不到咯。上篇文章那个是Service里面,很有可能就是@Service注解没有添加;而现在这个就是mapper找不到

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

Action:

Consider defining a bean of type 'com..item.mapper.BrandMapper' in your configuration.

解决办法如下:
在启动类上面添加:@MapperScan(“com.xxx.item.mapper”)注解。()里面的内容,根据你自己的路径决定。另外,@MapperScan是在tk.mybatis下面的,注意别导错包。如下:

@SpringBootApplication
@EnableDiscoveryClient
@MapperScan("com.ztoshop.item.mapper")//这个是在tk.mybatis下面
public class ZtoItemServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(ZtoItemServiceApplication.class, args);
    }
}

你可能感兴趣的:(常见错误,Springboot,springboot常见异常)