Search in sources :

Example 66 with DriverManagerDataSource

use of org.springframework.jdbc.datasource.DriverManagerDataSource in project vertx-examples by vert-x3.

the class ExampleSpringConfiguration method dataSource.

@Bean
@Autowired
public DataSource dataSource(DatabasePopulator populator) {
    final DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName"));
    dataSource.setUrl(env.getProperty("jdbc.url"));
    dataSource.setUsername(env.getProperty("jdbc.username"));
    dataSource.setPassword(env.getProperty("jdbc.password"));
    DatabasePopulatorUtils.execute(populator, dataSource);
    return dataSource;
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) Autowired(org.springframework.beans.factory.annotation.Autowired) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 67 with DriverManagerDataSource

use of org.springframework.jdbc.datasource.DriverManagerDataSource in project ff4j by ff4j.

the class SpringJdbcPropertyStoreTestDocker method getDataSource.

public DataSource getDataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.postgresql.Driver");
    dataSource.setUrl(postgresContainer.getJdbcUrl());
    dataSource.setUsername(postgresContainer.getUsername());
    dataSource.setPassword(postgresContainer.getPassword());
    return dataSource;
}
Also used : DriverManagerDataSource(org.springframework.jdbc.datasource.DriverManagerDataSource)

Aggregations

DriverManagerDataSource (org.springframework.jdbc.datasource.DriverManagerDataSource)67 Bean (org.springframework.context.annotation.Bean)29 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)20 Test (org.junit.jupiter.api.Test)9 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)8 DataSource (javax.sql.DataSource)7 SQLException (java.sql.SQLException)4 Properties (java.util.Properties)4 PersistenceUnitInfo (jakarta.persistence.spi.PersistenceUnitInfo)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 Connection (java.sql.Connection)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 InitialContext (javax.naming.InitialContext)2 XADataSource (javax.sql.XADataSource)2 Before (org.junit.Before)2 ApplicationContextHolder (org.mifos.application.servicefacade.ApplicationContextHolder)2 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)2