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
@WebMvcTest(UserController.class)
publicclassUserControllerTest {
// some tests here
}
And then I've got like this:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'natsConnection' defined in class path resource [io/nats/spring/boot/autoconfigure/NatsAutoConfiguration.class]: Failed to instantiate [io.nats.client.Connection]: Factory method 'natsConnection' threw exception with message: Unable to connect to NATS servers: [nats://localhost:4222]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
The spring boot 3.x only has dependencies with default beans:
Context case:
I'm trying to test only one controller like:
And then I've got like this:
The spring boot 3.x only has dependencies with default beans:
Solve. I have to write tests every time like below:
The text was updated successfully, but these errors were encountered: