Skip to content

spring-cloud-task and spring-data-jpa auto configuration cannot be used together #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Ramblurr opened this issue Jan 13, 2017 · 4 comments

Comments

@Ramblurr
Copy link

There is a conflict when using spring-cloud-task and spring-data-jpa together with the most simple auto configuration.

spring-cloud-task instantiates a transactionManager, but it is not of the type JpaTransactionManager that spring-data-jpa expects..

The workaround is to provide your own JpaTransactionManager.

Here is a minimal sample project showing the problem including the workaround:

https://github.com/Ramblurr/spring-data-task-conflict

@cppwfs
Copy link
Collaborator

cppwfs commented Jan 13, 2017

In this case You would want to create your own TaskConfigurer to return the transaction manager you want. Which can be found here: https://github.com/spring-cloud/spring-cloud-task/blob/master/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/configuration/TaskConfigurer.java You can use the the DefaultTaskConfigurer as a guide.

@mminella
Copy link
Contributor

As @cppwfs notes, this use case is addressed by the existing functionality. I'm closing this unless there is some other aspect that is missing.

@Ramblurr
Copy link
Author

Fair enough, I see the TaskConfigurer can be used to provide the custom transaction manager.

But shouldn't this gotcha with spring-data be documented somewhere? I can't imagine using spring-data and spring-cloud-task is far from ordinary. Just a few words somewhere pointing out that you can't use spring-data and cloud-task out of the box together would have saved me an hour or so.

@cppwfs
Copy link
Collaborator

cppwfs commented Jan 16, 2017

I agree. Opened an issue to address this: #272.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants