Spring-boot: Consider adding DataJdbcTest

Created on 5 Aug 2016  路  8Comments  路  Source: spring-projects/spring-boot

Someone asked on stackoverflow how to create their own test annotations.

Looking around I could see at least that we could share the exclude filter. Maybe we could also include the jdbc template support itself? I am not sure if that's a common pattern.

enhancement

Most helpful comment

You're right Johnny, maybe the name of the annotation should change. I'll take that into consideration. Thanks!

All 8 comments

In the meantime it would make a great blog post!

OK, I'll work on that.

Just out of curiosity, I thought with @DataJpaTest Data implies the Spring Data project but it looks I misunderstood as with @DataJdbcTest Data actually means a general word 'data', right?

You're right Johnny, maybe the name of the annotation should change. I'll take that into consideration. Thanks!

How about @JdbcTest ?

Alright I have a working solution but before I merge we need to discuss something a bit annoying

@philwebb @wilkinsona AutoconfigureTestDatabase is in the orm.jpa package and my JdbcTest is in the jdbc package. This commit has now a direct dependency to orm.jpa. Arguably, AutoconfigureTestDatabase would be better placed in the jdbc package (see spring-boot-autoconfigure) but that's quite a breaking change.

Thoughts?

Seeing how AutoConfigureTestDatabase imports org.springframework.boot.autoconfigure.jdbc.EmbeddedDatabaseConnection I'd say you're right. We should move that annotation and deprecate it in 1.5.

We might be able to get away with meta-annotating the deprecated annotation with the new one.

Reopen to remove deprecated code on master

Was this page helpful?
0 / 5 - 0 ratings