-
Notifications
You must be signed in to change notification settings - Fork 40.6k
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
@AutoConfigureTestDatabase NPE when no datasource to replace exists #6897
Comments
Well... this fixes the NPE, but I don't know if this results in the expected behavior. I see the "No DataSource beans found, embedded version will not be used" output in the log, but why is that? I was expecting it to work even if no datasource to replace is existing / configured (which led me to the NPE in the first place). If this is indeed the expected behavior, i propose a documentation update for @AutoConfigureTestDatabase to reflect that restriction. Edit: Begs the question what the replace parameter of @AutoConfigureTestDatabase is supposed to do. I might have expected "NONE" to work in a no-datasource scenario, but I was wrong here. So - open for clarification. |
Ahh yes, I see we forgot to always import |
Yep, problem fixed. Thanks a lot for the quick fix! :) One thing that caught my eye tho - In my test project there is no pom dependency for an embedded database. As such, the configuration fails with a cryptic stacktrace. However, if I add the H2 dependency, all is well. So I leave this here for polish if wanted, since this is just an user-configuration problem ;-)
|
@kernle32dll I've raised #6916 to deal with that one. Thanks for the suggestion. |
Hi there,
I realized something today while refactoring my code. When using
@AutoConfigureTestDatabase
for tests without providing an datasource to replace, you run into an NPE while initializing. Ironically in the place, where it is supposed to log the datasource bean it is replacing.Stack trace and sample project attached. Confirmed with 1.4.0.RELEASE and 1.4.1-BUILD-SNAPSHOT as of the time of opening the issue.
Sample project: datasourcenpe.zip
The text was updated successfully, but these errors were encountered: