springboot+mybatis-plus快速精简配置

1.依赖

<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.verson}</version>
</dependency>

2.配置文件

mybatis-plus.mapper-locations=classpath:com/it/lion/mapper/*.xml
mybatis-plus.type-aliases-package=com.it.lion
mybatis-plus.configuration.map-underscore-to-camel-case: true

3.业务层

接口:public interface UserService extends IService<User> {}
实现类:
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
}

4.mapper/dao层

@Mapper
public interface UserMapper extends BaseMapper<User> {

}

5.启动类不要加任何东西,直接

@SpringBootApplication

看了很多网上的什么鬼加注解,排除自动注入,没明白要干什么,spring帮你处理它不好么?



posted @ 2021-06-15 12:29  kidnap  阅读(66)  评论(0编辑  收藏  举报