AppConfig { @Bean(destroyMethod = "close") public DataSource dataSource() { BasicDataSource basicDataSource = new BasicDataSource(); basicDataSource.setDriverClassName("org.h2.Driver"); basicDataSource.setUrl("jdbc:h2:~/databases/person"); basicDataSource.setUsername("sa"); basicDataSource.setPassword("sa"); return (DataSource) basicDataSource; }  static void main(String[] args); @Bean(destroyMethod = "close") DataSource dataSource(); @Bean LocalContainerEntityManagerFactoryBean entityManagerFactory(); @Bean JpaTransactionManager transactionManager();  }
@Test public void testDataSource() { assertNotNull(dataSource); }