-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cf559b
commit d0ff5a7
Showing
3 changed files
with
74 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
cosmo-webapp/src/main/java/com/unitedinternet/calendar/DataSourceConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.unitedinternet.calendar; | ||
|
||
import javax.sql.DataSource; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.DependsOn; | ||
|
||
import com.zaxxer.hikari.HikariConfig; | ||
import com.zaxxer.hikari.HikariDataSource; | ||
|
||
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; | ||
|
||
/** | ||
* Data source configuration that starts an embedded Maria DB instance before data source is created. | ||
* | ||
* @author daniel grigore | ||
* | ||
*/ | ||
@Configuration | ||
@ConfigurationProperties("spring.datasource") | ||
public class DataSourceConfig extends HikariConfig { | ||
|
||
@Bean(initMethod = "start", destroyMethod = "stop", name = "mariaDB") | ||
public MariaDB4jSpringService mariaDBService() { | ||
MariaDB4jSpringService db = new MariaDB4jSpringService(); | ||
db.setDefaultBaseDir("target/maridb/base"); | ||
db.setDefaultDataDir("target/maridb/data"); | ||
db.setDefaultPort(33060); | ||
return db; | ||
} | ||
|
||
@Bean | ||
@DependsOn("mariaDB") | ||
public DataSource ds() { | ||
return new HikariDataSource(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters