打卡7

所花时间(包括上课) 2h
代码量(行) 约150行
博客量(篇) 1
了解到的知识 spring boot
备注  

<!--
mybatis对springboot的支持
不需要额外引入 mybatis的依赖
-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<!-- 数据源 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.20</version>
</dependency>
<!-- mysql相关依赖 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0</version>
</dependency>

server:
port: 8989
servlet:
context-path: /springboot
spring:
datasource:
username: root #数据库用户名
password: 20223959 #数据库密码
type: com.alibaba.druid.pool.DruidDataSource #type
url: jdbc:mysql://localhost:3306/test #url
driver-class-name: com.mysql.jdbc.Driver #驱动
mybatis:
#扫描映射文件
mapper-locations: classpath:com/bz/mapper/**/*Mapper.xml
#实体类定义别名
type-aliases-package: com.bz.entity

<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>

@SpringBootApplication
//dao 扫描
@MapperScan("com.bz.dao")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

 

//springboot环境运行
@RunWith(SpringRunner.class)
//加载 入口类
@SpringBootTest(classes = Application.class)
public class SpringbootApplicationTests {
@Test
public void contextLoads() {
}
}

posted @   平安喜乐×  阅读(6)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
· 为什么 退出登录 或 修改密码 无法使 token 失效
点击右上角即可分享
微信分享提示