Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

programically set data source properties in spring

@Configuration
public class JpaConfig {

    @Bean
    public DataSource getDataSource()
    {
        DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
        dataSourceBuilder.driverClassName("org.h2.Driver");
        dataSourceBuilder.url("jdbc:h2:file:C:/temp/test");
        dataSourceBuilder.username("sa");
        dataSourceBuilder.password("");
        return dataSourceBuilder.build();
 
 
PREVIOUS NEXT
Tagged: #programically #set #data #source #properties #spring
ADD COMMENT
Topic
Name
1+3 =