💾 Setup SQLite database #3
3 changed files with 11 additions and 10 deletions
|
@ -3,7 +3,6 @@ package de.mlessmann.certassist.config;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||||
|
@ -17,7 +16,6 @@ import java.util.Properties;
|
||||||
@Configuration
|
@Configuration
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@EnableJpaRepositories(basePackages = "de.mlessmann.certassist.repositories")
|
@EnableJpaRepositories(basePackages = "de.mlessmann.certassist.repositories")
|
||||||
@PropertySource("classpath:persistence.properties")
|
|
||||||
public class DatabaseConfig {
|
public class DatabaseConfig {
|
||||||
|
|
||||||
private static final String HIBERNATE_DIALECT_PROPERTY = "hibernate.dialect";
|
private static final String HIBERNATE_DIALECT_PROPERTY = "hibernate.dialect";
|
||||||
|
@ -46,7 +44,7 @@ public class DatabaseConfig {
|
||||||
return entityManagerFactory;
|
return entityManagerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Properties additionalProperties() {
|
private Properties additionalProperties() {
|
||||||
final Properties hibernateProperties = new Properties();
|
final Properties hibernateProperties = new Properties();
|
||||||
if (env.getProperty(HIBERNATE_HBM_2_DDL_AUTO_PROPERTY) != null) {
|
if (env.getProperty(HIBERNATE_HBM_2_DDL_AUTO_PROPERTY) != null) {
|
||||||
hibernateProperties.setProperty(HIBERNATE_HBM_2_DDL_AUTO_PROPERTY, env.getProperty(HIBERNATE_HBM_2_DDL_AUTO_PROPERTY));
|
hibernateProperties.setProperty(HIBERNATE_HBM_2_DDL_AUTO_PROPERTY, env.getProperty(HIBERNATE_HBM_2_DDL_AUTO_PROPERTY));
|
||||||
|
|
|
@ -1 +1,11 @@
|
||||||
|
# General
|
||||||
spring.application.name=home-cert-assistant
|
spring.application.name=home-cert-assistant
|
||||||
|
# Database
|
||||||
|
driverClassName=org.sqlite.JDBC
|
||||||
|
url=jdbc:sqlite:sqlLiteDb:database?cache=shared
|
||||||
|
username=admin
|
||||||
|
password=admin
|
||||||
|
spring.jpa.database-platform=org.hibernate.community.dialect.SQLiteDialect
|
||||||
|
#TODO: Use flyway for db setup
|
||||||
|
hibernate.hbm2ddl.auto=create-drop
|
||||||
|
hibernate.show_sql=true
|
|
@ -1,7 +0,0 @@
|
||||||
driverClassName=org.sqlite.JDBC
|
|
||||||
url=jdbc:sqlite:sqlLiteDb:database?cache=shared
|
|
||||||
username=admin
|
|
||||||
password=admin
|
|
||||||
spring.jpa.database-platform=org.hibernate.community.dialect.SQLiteDialect
|
|
||||||
hibernate.hbm2ddl.auto=create-drop
|
|
||||||
hibernate.show_sql=true
|
|
Loading…
Add table
Reference in a new issue