Kr Younger пре 6 година
родитељ
комит
632756282f
3 измењених фајлова са 36 додато и 3 уклоњено
  1. 6
    0
      application.properties
  2. 11
    3
      pom.xml
  3. 19
    0
      src/main/java/com/example/throwupthursday/config/DatabaseConfig.java

+ 6
- 0
application.properties Прегледај датотеку

@@ -0,0 +1,6 @@
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 Прегледај датотеку

@@ -51,15 +51,23 @@
51 51
 		</dependency>
52 52
 
53 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 56
 		</dependency>
58 57
 		<dependency>
59 58
 			<groupId>org.springframework.boot</groupId>
60 59
 			<artifactId>spring-boot-starter-test</artifactId>
61 60
 			<scope>test</scope>
62 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 71
 	</dependencies>
64 72
 
65 73
 	<build>

+ 19
- 0
src/main/java/com/example/throwupthursday/config/DatabaseConfig.java Прегледај датотеку

@@ -0,0 +1,19 @@
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
+}