Skip to main content
Glama
UnitTest01.java1.11 kB
package ink.openmind.springbootsamplejdbcproject; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; /** * @author :Wangzhuang2 * @version : 1.0.0 * @date :Created in 2020/11/14 22:08 * DESC */ @RunWith(SpringRunner.class) @SpringBootTest public class UnitTest01 { // 注入数据源对象 @Autowired private DataSource dataSource; @Test public void datasourceTest() throws SQLException { // 获取数据源类型 System.out.println("默认数据源为: " + dataSource.getClass()); // 默认数据源为: class com.zaxxer.hikari.HikariDataSource // 获取数据库连接对象 Connection connection = dataSource.getConnection(); // 判断连接对象是否为空 System.out.println(connection != null); connection.close(); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yuwencheng0212/ppt'

If you have feedback or need assistance with the MCP directory API, please join our Discord server