Skip to content

Commit 2ef9e06

Browse files
committed
Moved from MySQL to PostgreSQL; Prepared for production
1 parent 0999c4b commit 2ef9e06

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

pom.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@
4040
<artifactId>spring-boot-starter-data-jpa</artifactId>
4141
</dependency>
4242

43+
<!--<dependency>
44+
<groupId>org.springframework.boot</groupId>
45+
<artifactId>spring-boot-starter-tomcat</artifactId>
46+
<scope>provided</scope>
47+
</dependency>-->
48+
4349
<dependency>
44-
<groupId>mysql</groupId>
45-
<artifactId>mysql-connector-java</artifactId>
46-
<version>6.0.4</version>
50+
<groupId>org.postgresql</groupId>
51+
<artifactId>postgresql</artifactId>
52+
<version>9.4.1211.jre7</version>
4753
</dependency>
4854

49-
5055
<dependency>
5156
<groupId>org.springframework.boot</groupId>
5257
<artifactId>spring-boot-starter-test</artifactId>
@@ -71,5 +76,4 @@
7176
</plugins>
7277
</build>
7378

74-
7579
</project>

src/main/java/com/olegshan/JobParserApplication.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.builder.SpringApplicationBuilder;
6+
import org.springframework.boot.web.support.SpringBootServletInitializer;
57
import org.springframework.scheduling.annotation.EnableScheduling;
68

79
@EnableScheduling
810
@SpringBootApplication
9-
public class JobParserApplication {
11+
public class JobParserApplication extends SpringBootServletInitializer {
1012

1113
public static void main(String[] args) {
1214
SpringApplication.run(JobParserApplication.class, args);
15+
}
1316

17+
@Override
18+
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
19+
return builder.sources(JobParserApplication.class);
1420
}
1521
}

src/main/java/com/olegshan/entity/Doc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public class Doc {
1212

1313
@Id
1414
String name;
15-
@Column(length = Integer.MAX_VALUE)
15+
// @Column(length = Integer.MAX_VALUE)
16+
@Column(length = 10485760)
1617
String doc;
1718

1819
public Doc() {

src/main/java/com/olegshan/entity/Job.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public class Job {
1515
@Id
1616
private String url;
1717
private String title;
18-
@Column(length = Integer.MAX_VALUE)
18+
// @Column(length = Integer.MAX_VALUE)
19+
@Column(length = 10485760)
1920
private String description;
2021
private String company;
2122
private String source;
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
spring.datasource.url = jdbc:mysql://localhost:3306/jparser
2-
spring.datasource.username = root
1+
spring.datasource.url = jdbc:postgresql://localhost:5432/jparser
2+
spring.datasource.username = postgres
33
spring.datasource.password = root
4-
spring.datasource.testWhileIdle = true
5-
spring.datasource.validationQuery = SELECT 1
64
spring.jpa.show-sql = true
75
spring.jpa.hibernate.ddl-auto = update
8-
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
6+
7+
#spring.datasource.url = jdbc:postgresql://${RDS_HOSTNAME}:${RDS_PORT}/${RDS_DB_NAME}
8+
#spring.datasource.username = ${RDS_USERNAME}
9+
#spring.datasource.password = ${RDS_PASSWORD}
10+
#spring.thymeleaf.encoding=UTF-8
11+
#spring.jpa.hibernate.ddl-auto = update
12+
#spring.resources.chain.strategy.content.enabled=true
13+
#spring.resources.chain.strategy.content.paths=/**

0 commit comments

Comments
 (0)