Skip to content

Instantly share code, notes, and snippets.

@mrpehlivan
Last active April 21, 2018 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrpehlivan/86ed6bcdb3f6025f9b1d570e83bc5da4 to your computer and use it in GitHub Desktop.
Save mrpehlivan/86ed6bcdb3f6025f9b1d570e83bc5da4 to your computer and use it in GitHub Desktop.
DatabaseConfiguration.java
package com.arif.crud.configuration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
@Configuration
@EnableJpaRepositories("com.arif")
@EnableTransactionManagement
public class DatabaseConfiguration {
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment