第一种 import org.springframework.jdbc.datasource.DataSourceUtils; @AutowiredDataSource dataSource; Connection connection = DataSourceUtils.getConnection(dataSource); 第二种 Connection con = ((SessionImplementor) session).connection();