When using Spring Data JDBC, it's fairly common to provide a bean that's an AbstractJdbcConfiguration sub-class. For example, such a sub-class is used to register custom converters used during reading and writing of entities. At the moment, such beans are filtered out by @DataJdbcTest.
They can be included using a custom filter:
@DataJdbcTest(includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
classes = AbstractJdbcConfiguration.class))
It would be good if this include filter wasn't necessary and AbstractJdbcConfiguration beans were included automatically.
Comment From: raqueru
Hello! I'm new to this project and I'd like to understand better where can i find the solution for this issue
Comment From: wilkinsona
I'd start by creating a new test class named DataJdbcTypeExcludeFilterTests, and writing a test that asserts that
DataJdbcTypeExcludeFilter does not exclude an AbstractJdbcConfiguration sub-class. It should fail to begin with.
With the test in place, DataJdbcTypeExcludeFilter can then be changed to include AbstractJdbcConfiguration. To do so, its getDefaultIncludes() method should be overridden to return a Set that contains AbstractJdbcConfiguration.class. With this change in place, the new test that was failing should now pass.
Comment From: raviu
@wilkinsona I've raised a PR for this enhancement per your instructions: https://github.com/spring-projects/spring-boot/pull/29003/files.
Hoping to get my feet wet with the project and this seemed a good place to start! @raqueru apologies in case you're still working on this one.
Comment From: snicoll
@raqueru were you working on this issue or are you still willing to contribute something?
@raviu thanks for the PR but I'd have preferred to check first before submitting. I agree it is a bit blurry whether @raqueru is working on it or not but we prefer to give contributors a chance to sort things out before someone else submits something.
Let's see what @raqueru says and we'll proceed accordingly.
Comment From: raqueru
No problem! I was trying to solve it but if Raviu already did it, you can proceed
Comment From: mbhave
Closing in favor of PR #29003.