企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ <!--连接池--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <!--数据库驱动--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!--mybatis启动器--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.2</version> </dependency> ~~~ ~~~ spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://192.168.10.10/jdbc username: homestead password: secret ~~~ ## 开启mybatis驼峰配置: 默认是null,也就是false. ~~~ mybatis: configuration: map-underscore-to-camel-case: true ~~~ ## 指定mapper xml文件位置 ~~~ mapper-locations: mapper/*.xml ~~~ ## 配置pojo别名 ~~~ type-aliases-package: com.like.pojo ~~~ ## 配置扫描mapper接口 在启动类上指定 ~~~ package com.like; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication @MapperScan("com.like.mapper") //配置扫描mapper接口 public class Application { public static void main(String[] args) { SpringApplication.run(Application.class); } } ~~~