Class MockServerAutoConfiguration
ClientAndServer and exposes it as a
MockServerClient bean, driven by mockserver.* properties (see MockServerProperties).
Development / test only. This starts a real MockServer instance inside the
application context, so it is intended for integration tests and local development - not production.
It is disabled by default and only activates when mockserver.enabled=true is set.
Lifecycle: the ClientAndServer bean is created when the application context is refreshed
(server starts) and stopped when the context is closed (via the bean destroyMethod).
A single ClientAndServer bean is registered. Because ClientAndServer extends
MockServerClient, that one bean satisfies injection points typed as either
ClientAndServer or MockServerClient (and getBean(MockServerClient.class)).
Register your own ClientAndServer bean to override the auto-configured one - the
ConditionalOnMissingBean guard then backs off.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmockServerClientAndServer(MockServerProperties properties) Starts a MockServer instance and exposes it as aClientAndServerbean.
-
Constructor Details
-
MockServerAutoConfiguration
public MockServerAutoConfiguration()
-
-
Method Details
-
mockServerClientAndServer
@Bean(destroyMethod="stop") @ConditionalOnMissingBean public ClientAndServer mockServerClientAndServer(MockServerProperties properties) Starts a MockServer instance and exposes it as aClientAndServerbean. BecauseClientAndServerextendsMockServerClient, this single bean also satisfies injection points that request aMockServerClient.The bean's
destroyMethodisstop, so the embedded server is shut down when the Spring context is closed.
-