时间:2021-07-01 10:21:17 帮助过:11人阅读
application.properties的默认写法
- <span style="color: #000000;">#数据源
- spring.datasource.url</span>=jdbc:mysql:<span style="color: #008000;">//</span><span style="color: #008000;">120.78.206.78:3306/testMybatisClient?useUnicode=true&characterEncoding=utf8</span>
- spring.datasource.username=<span style="color: #000000;">root
- spring.datasource.password</span>=<span style="color: #000000;">Root123..
- #用来实例化mapper接口
- mybatis.type</span>-aliases-package=<span style="color: #000000;">com.littlepage.mapper
- #对应的sql映射
- mybatis.mapper</span>-locations=classpath:mybatis/mapper<span style="color: #008000;">/*</span><span style="color: #008000;">.xml
- #首页
- server.servlet.context-path=/
- #日志级别
- logging.level.com.littlepage.mybatis.mapper=debug
- #连接池
- spring.datasource.hikari.minimum-idle=3
- spring.datasource.hikari.maximum-pool-size=10
- spring.datasource.hikari.max-lifetime =30000
- spring.datasource.hikari.connection-test-query=SELECT 1</span>
MapperScan
- <span style="color: #000000;">@SpringBootApplication
- @MapperScan(</span><span style="color: #800000;">"</span><span style="color: #800000;">com.littlepage.mapper</span><span style="color: #800000;">"</span><span style="color: #000000;">)
- </span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span><span style="color: #000000;"> MybatisApplication {
- </span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span><span style="color: #000000;"> main(String[] args) {
- SpringApplication.run(MybatisApplication.</span><span style="color: #0000ff;">class</span><span style="color: #000000;">, args);
- }
- }
- 启动类进行mapper的扫描</span>
SpringBootMybatis 关于Mybatis-generator-gui的使用|数据库的编码注意点|各项复制模板
标签:package 使用 roo source int 需要 有关 context 接口