You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So recently I had problems testing something that would have been easy to do with TransactionTemplate, that something was envers and it's documented in the spring data envers docs, which I didn't completely read, and that's my fault. However, doing this with spring boot is a little different because it can set the test up for you. However, it's perhaps not as streamlined as DataJpaTest. This is what came up with
I'm not even sure if that's all necessary, but it works.
However I was thinking at minimum it might be nice to document in the reference docs. The javadoc for @AutoconfigureDataJpa also suggests I shouldn't be using it, it might be better to update that to "when" I should be using it.
I'm thinking that it might be convenient to add @DataTransactionTemplateTest and @JdbcTransactionTemplateTest, but that might be overkill when documentation would suffice. However, if those were to exist they could possibly go the next mile and set up a different h2 database that would get destroyed either at the end of the test or at least after class, instead of perpetuating for the whole suite (which I believe it does now).
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion, but I think it might be hard for us to describe this scenario in the @AutoconfigureDataJpa javadoc.
The "Most tests should consider using ... rather than using this annotation directly" is standard text that we put on many @Autoconfigure... annotations. We're basically trying to say that you should use usually the @...Test annotation, but the @Autoconfigure... annotations are here if you need more fine-grained control.
I'm afraid that adding a @DataTransactionTemplateTest feels a bit too specific as well. I think we need to hit the sweet spot of offering useful annotations without having too many of them. You could probably add this annotation to your own code and meta-annotate it with the subset of @AutoconfigureDataJpa annotations that you need.
So recently I had problems testing something that would have been easy to do with
TransactionTemplate
, that something wasenvers
and it's documented in the spring data envers docs, which I didn't completely read, and that's my fault. However, doing this with spring boot is a little different because it can set the test up for you. However, it's perhaps not as streamlined asDataJpaTest
. This is what came up withI'm not even sure if that's all necessary, but it works.
However I was thinking at minimum it might be nice to document in the reference docs. The javadoc for
@AutoconfigureDataJpa
also suggests I shouldn't be using it, it might be better to update that to "when" I should be using it.I'm thinking that it might be convenient to add
@DataTransactionTemplateTest
and@JdbcTransactionTemplateTest
, but that might be overkill when documentation would suffice. However, if those were to exist they could possibly go the next mile and set up a different h2 database that would get destroyed either at the end of the test or at least after class, instead of perpetuating for the whole suite (which I believe it does now).The text was updated successfully, but these errors were encountered: