-
Notifications
You must be signed in to change notification settings - Fork 396
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
@ShellTest ApplicationContext not loading Beans or Configuration during Integration Tests #721
Comments
Hi, this is currently expected as that's how boot test slices work https://docs.spring.io/spring-boot/docs/3.0.6/reference/htmlsingle/#features.testing.spring-boot-applications.autoconfigured-tests. It's better summarised in this blog post https://josefczech.cz/2020/03/08/3-tips-for-using-spring-boot-test-slices/. I'm wondering if we should try to make testing of a full app easier, aka shell specific |
I think having an annotation more similar to How can I load all Beans (or even just the relevant ones) with |
You need to import configs manually. I'll think about this a little and create a new issue. I do appreciate feedback as that helps to develop things more aligned what users need. |
Superseded by #738 |
This works for me:
|
I generated a project using Spring Initializr with spring-shell. I'm trying to run Integration Tests, but it seems that the ApplicationContext of the test class is not being loaded correctly.
Below is the simple command I made. If I do not import the
OtherService
, the integration test works fine.The Integration test is as follows:
When I run
mvn verify
, I get the following output:In a different project, I am using
spring-shell
with Embedded PostGres, and it seems that the database@Configuration
files are not being loaded properly either. I have tried a lot of different annotation combinations to no avail. It seems that the@ShellTest
annotation does almost everything that the@SpringBootApplication
annotation does, but it is not fully loading theApplicationContext
. Please let me know if you would like me to provide more context, or information about my other use case with Embedded PostGres.The full code can be found here.
The text was updated successfully, but these errors were encountered: