Browse Source

added postgres

Kr Younger 6 years ago
parent
commit
632756282f

+ 6
- 0
application.properties View File

1
+spring.datasource.driverClassName=org.postgresql.Driver
2
+spring.datasource.maxActive=10
3
+spring.datasource.maxIdle=5
4
+spring.datasource.minIdle=2
5
+spring.datasource.initialSize=5
6
+spring.datasource.removeAbandoned=true

+ 11
- 3
pom.xml View File

51
 		</dependency>
51
 		</dependency>
52
 
52
 
53
 		<dependency>
53
 		<dependency>
54
-			<groupId>org.hsqldb</groupId>
55
-			<artifactId>hsqldb</artifactId>
56
-			<scope>runtime</scope>
54
+			<groupId>org.postgresql</groupId>
55
+			<artifactId>postgresql</artifactId>
57
 		</dependency>
56
 		</dependency>
58
 		<dependency>
57
 		<dependency>
59
 			<groupId>org.springframework.boot</groupId>
58
 			<groupId>org.springframework.boot</groupId>
60
 			<artifactId>spring-boot-starter-test</artifactId>
59
 			<artifactId>spring-boot-starter-test</artifactId>
61
 			<scope>test</scope>
60
 			<scope>test</scope>
62
 		</dependency>
61
 		</dependency>
62
+		<dependency>
63
+			<groupId>org.springframework.boot</groupId>
64
+			<artifactId>spring-boot-starter-jdbc</artifactId>
65
+		</dependency>
66
+		<dependency>
67
+			<groupId>com.example</groupId>
68
+			<artifactId>throwup-thursday</artifactId>
69
+			<version>0.0.1-SNAPSHOT</version>
70
+		</dependency>
63
 	</dependencies>
71
 	</dependencies>
64
 
72
 
65
 	<build>
73
 	<build>

+ 19
- 0
src/main/java/com/example/throwupthursday/config/DatabaseConfig.java View File

1
+package com.example.throwupthursday.config;
2
+
3
+import org.springframework.boot.context.properties.ConfigurationProperties;
4
+import org.springframework.boot.jdbc.DataSourceBuilder;
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+import org.springframework.context.annotation.Primary;
8
+
9
+import javax.sql.DataSource;
10
+
11
+@Configuration
12
+public class DatabaseConfig {
13
+    @Bean
14
+    @Primary
15
+    @ConfigurationProperties(prefix = "spring.datasource")
16
+    public DataSource dataSource() {
17
+        return DataSourceBuilder.create().build();
18
+    }
19
+}