Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created jOOQ Spring Boot Configuration and moved related classes to c…
…onfig package. Moved service types to service package.
- Loading branch information
JackG
committed
Jul 14, 2015
1 parent
783dc54
commit 1d63c5f
Showing
8 changed files
with
76 additions
and
47 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
2 changes: 1 addition & 1 deletion
2
...q/example/spring/ExceptionTranslator.java → ...le/spring/config/ExceptionTranslator.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
65 changes: 65 additions & 0 deletions
65
...oot-example/src/main/java/org/jooq/example/spring/config/JooqSpringBootConfiguration.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,65 @@ | |||
package org.jooq.example.spring.config; | |||
|
|||
import org.jooq.ConnectionProvider; | |||
import org.jooq.DSLContext; | |||
import org.jooq.ExecuteListenerProvider; | |||
import org.jooq.SQLDialect; | |||
import org.jooq.TransactionProvider; | |||
import org.jooq.impl.DataSourceConnectionProvider; | |||
import org.jooq.impl.DefaultConfiguration; | |||
import org.jooq.impl.DefaultDSLContext; | |||
import org.jooq.impl.DefaultExecuteListenerProvider; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |||
import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy; | |||
|
|||
import javax.sql.DataSource; | |||
|
|||
/** | |||
* @author Jacques Gonzalez | |||
*/ | |||
@Configuration | |||
public class JooqSpringBootConfiguration { | |||
|
|||
@Bean | |||
public DataSourceTransactionManager transactionManager(DataSource dataSource) { | |||
return new DataSourceTransactionManager(dataSource); | |||
} | |||
|
|||
@Bean | |||
public DSLContext dsl(org.jooq.Configuration config) { | |||
return new DefaultDSLContext(config); | |||
} | |||
|
|||
@Bean | |||
public ConnectionProvider connectionProvider(DataSource dataSource) { | |||
return new DataSourceConnectionProvider(new TransactionAwareDataSourceProxy(dataSource)); | |||
} | |||
|
|||
@Bean | |||
public TransactionProvider transactionProvider() { | |||
return new SpringTransactionProvider(); | |||
} | |||
|
|||
@Bean | |||
public ExceptionTranslator exceptionTranslator() { | |||
return new ExceptionTranslator(); | |||
} | |||
|
|||
@Bean | |||
public ExecuteListenerProvider executeListenerProvider(ExceptionTranslator exceptionTranslator) { | |||
return new DefaultExecuteListenerProvider(exceptionTranslator); | |||
} | |||
|
|||
@Bean | |||
public org.jooq.Configuration jooqConfig(ConnectionProvider connectionProvider, | |||
TransactionProvider transactionProvider, ExecuteListenerProvider executeListenerProvider) { | |||
|
|||
return new DefaultConfiguration() // | |||
.derive(connectionProvider) // | |||
.derive(transactionProvider) // | |||
.derive(executeListenerProvider) // | |||
.derive(SQLDialect.H2); | |||
} | |||
} |
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
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
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
2 changes: 1 addition & 1 deletion
2
...oq/example/spring/DefaultBookService.java → ...le/spring/service/DefaultBookService.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
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