首页 > 其他分享 >打卡7

打卡7

时间:2024-06-16 11:23:06浏览次数:36  
标签:spring boot mysql mybatis 打卡 com class

所花时间(包括上课) 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() {
}
}

标签:spring,boot,mysql,mybatis,打卡,com,class
From: https://www.cnblogs.com/pinganxile/p/18250322

相关文章