@Bean
  public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource(dbUrl, userName, password);
    dataSource.setDriverClassName(Driver.class.getName());

    // no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
    // EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    // EmbeddedDatabase dataSource = builder.setType(EmbeddedDatabaseType.H2).setName("h2_example").build();
    return dataSource;
  }
@ Bean public DataSource dataSource ( ) { DriverManagerDataSource dataSource = new DriverManagerDataSource ( dbUrl , userName , password ) ; dataSource . setDriverClassName ( Driver . class . getName ( ) ) ; return dataSource ; }
H2 Data source.
jdbc:h2:mem:test

@return data source.