Class MockServerAutoConfiguration

java.lang.Object
org.mockserver.springboot.MockServerAutoConfiguration

@AutoConfiguration @ConditionalOnProperty(prefix="mockserver", name="enabled", havingValue="true") @EnableConfigurationProperties(MockServerProperties.class) public class MockServerAutoConfiguration extends Object
Spring Boot auto-configuration that starts a 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 Details

    • MockServerAutoConfiguration

      public MockServerAutoConfiguration()
  • Method Details