标签:text print 关闭 cat etc system row span except
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
spring:
datasource:
username: 数据库名
password: 密码
url: jdbc:mysql://192.168.0.1:3306/数据库
driver-class-name: com.mysql.cj.jdbc.Driver
@SpringBootTest
class DemoApplicationTests {
@Autowired
DataSource dataSource;
@Test
void contextLoads() throws SQLException {
System.out.println(dataSource.getClass());
Connection connection = dataSource.getConnection();
System.out.println(connection);
connection.close();//关闭连接
}
}
标签:text print 关闭 cat etc system row span except
原文地址:https://www.cnblogs.com/ljkltt/p/14225192.html