File tree Expand file tree Collapse file tree 3 files changed +8
-22
lines changed
Expand file tree Collapse file tree 3 files changed +8
-22
lines changed Original file line number Diff line number Diff line change 3333 <groupId >org.springframework.boot</groupId >
3434 <artifactId >spring-boot-starter-web</artifactId >
3535 </dependency >
36+ <dependency >
37+ <groupId >org.springframework.boot</groupId >
38+ <artifactId >spring-boot-starter-jdbc</artifactId >
39+ </dependency >
3640 <dependency >
3741 <groupId >org.springframework.boot</groupId >
3842 <artifactId >spring-boot-starter-thymeleaf</artifactId >
5256 <groupId >org.postgresql</groupId >
5357 <artifactId >postgresql</artifactId >
5458 </dependency >
55- <dependency >
56- <groupId >com.zaxxer</groupId >
57- <artifactId >HikariCP</artifactId >
58- </dependency >
5959 <dependency >
6060 <groupId >org.webjars</groupId >
6161 <artifactId >jquery</artifactId >
Original file line number Diff line number Diff line change 3838@ SpringBootApplication
3939public class Main {
4040
41- @ Value ("${spring.datasource.url}" )
42- private String dbUrl ;
43-
4441 @ Autowired
4542 private DataSource dataSource ;
4643
@@ -73,16 +70,4 @@ String db(Map<String, Object> model) {
7370 return "error" ;
7471 }
7572 }
76-
77- @ Bean
78- public DataSource dataSource () throws SQLException {
79- if (dbUrl == null || dbUrl .isEmpty ()) {
80- return new HikariDataSource ();
81- } else {
82- HikariConfig config = new HikariConfig ();
83- config .setJdbcUrl (dbUrl );
84- return new HikariDataSource (config );
85- }
86- }
87-
8873}
Original file line number Diff line number Diff line change 1- spring.datasource.url: ${JDBC_DATABASE_URL:}
2- spring.datasource.hikari.connection-timeout =30000
3- spring.datasource.hikari.maximum-pool-size =10
1+ spring.datasource.url =${JDBC_DATABASE_URL}
2+ spring.datasource.username =${DATABASE_USERNAME}
3+ spring.datasource.password =${DATABASE_PASSWORD}
4+ spring.datasource.driver-class-name =org.postgresql.Driver
45
56spring.thymeleaf.mode =HTML
67
You can’t perform that action at this time.
0 commit comments