第一种
    import org.springframework.jdbc.datasource.DataSourceUtils;

    @Autowired
    DataSource dataSource;

    Connection connection = DataSourceUtils.getConnection(dataSource);

    第二种
    Connection con = ((SessionImplementor) session).connection();