Update `TestcontainersLifecycleBeanPostProcessor` to that initialization
doesn't fail if a `BeanCurrentlyInCreationException` is thrown.
Prior to this commit, if the first bean being post-processed was a
configuration class declaring a bean that the `Container` depended on
all initialization would fail.
See gh-35223
Replace `SessionRepositoryFilterConfiguration` filter registration bean
with a `DelegatingFilterProxyRegistrationBean` so that
`SessionRepository` beans are not initialized early.
Fixes gh-35240
A manifest entry `Spring-Boot-Native-Processed: true` is added to the
jar manifest by the Maven or Gradle plugin when the jar has been built
for use in a native image. With the Gradle plugin, this is done in
reaction to the GraalVM Native Image Plugin being applied to the
project. With the Maven plugin, this is done when the `native` profile
is applied to the build.
Update `TestcontainersLifecycleBeanPostProcessor` so that on
initialization of the first bean all `Container` instances are started.
With this update all `Container` beans will be started first in the
`preInstantiateSingletons` phase and destroyed last.
Closes gh-35223
Update `ServiceConnectionContextCustomizer` so that is applies the
`TestcontainersLifecycleApplicationContextInitializer` to all
application contexts.
Closes gh-35222
Update `ServiceConnectionContextCustomizer` with `equals` and `hashcode`
methods so that it works correctly when part of a context cache key.
Closes gh-35216
Update `MainMethod` to search from the bottom of the stack rather than
the start. Prior to this commit, an incorrect `main` method would be
found if more than one `main` was in the stack.
Fixes gh-35214
Rather than implementing factories for FlywayConnectionDetails for
each supported SQL database, we instead use a factory to takes
JdbcConnectionDetails as a source and produces
FlywayConnectionDetails.
Closes gh-35138
Update testcontainers auto-configuration so that `Container` bean
instances are no longer needed when registering `ConnectionDetails`
beans. Registration now occurs based on the bean type and the `name`
attribute of `@ServiceConnection`.
Fixes gh-35168
Update `ContainerConnectionDetailsFactory` so that they consistently
extend `ContainerConnectionDetails`. The container is also no longer
accessible from the `ContainerConnectionSource` and is never used
during the construction of `ConnectionDetails` instances.
See gh-35168
Add `ExcludeFilterApplicationContextInitializer` to register the
`TestTypeExcludeFilter` for regular applications.
Prior to this commit, the filter was only registered using the
`ExcludeFilterContextCustomizerFactory` which meant that test components
were filtered in tests but not when using `SpringApplication.from` with
a test classpath.
Fixes gh-35206
This commit adds org.testcontainers:testcontainers as an api dependency
of spring-boot-testcontainers so that GenericContainer can be used
without an additional dependency
See gh-35119
Update `DockerComposeConnectionDetailsFactory` to accept a `Predicate`
based check to determine if the source should be accepted.
The existing name based checks have also been improved to allow names
outside of official docker images. The `ImageReference` and `ImageName`
classes have been mainly copied from
`org.springframework.boot.buildpack.platform.docker.type`.
Closes gh-35154
The properties `spring.couchbase.env.ssl.key-store`
and `spring.couchbase.env.ssl.key-store-password`
are deprecated in favor of configuring an SSL bundle with
`spring.couchbase.env.ssl.bundle`. The older properties
have somewhat confusing names, since they are used to
configure a trust store in Couchbase, and they don't
provide all the options that an SSL bundle provides.
Closes gh-35135
Introduce `WebClientSsl` interface and auto-configuration to allow a
WebClient builder to have custom SSL configuration applied.
The previous `ClientHttpConnectorConfiguration` has been been changed
to now create `ClientHttpConnectorFactory` instances which can be used
directly or by `AutoConfiguredWebClientSsl`.
Closes gh-18556
Update `SslOptions` so that `null` is used for default values rather
than empty sets. Most libraries use `null` to indicate defaults so
aligning our class makes things easier.
See gh-34814
Update Tomcat, Jetty, Undertow and Netty servers so that an SslBundle
is used to apply SSL configuration. Existing `Ssl` properties are
internally adapted to an `SslBundle` using the `WebServerSslBundle`
class. Additionally, if `Ssl.getBundle()` returns a non-null value the
the `SslBundles` bean will be used to find a registered bundle by name.
See gh-34814
Add auto-configuration for SSL bundles including new configuration
properties that can be used to define a bundle.
SSL bundle properties are provided under the `spring.ssl.bundle` key.
Currently `jks` and `pem` variants are support. Both are configured
as a `Map` where the bundle name is the key.
A typical example would be:
spring:
ssl:
bundle:
pem:
mybundle
key:
password: secret
keystore:
certificate: classpath:mycert.pem
private-key: classpath:mykey.pem
A `SslBundleRegistrar` interface is also provided to allow programmatic
contributions to the auto-configured `SslBundleRegistry`.
See gh-34814
Add classes to support SSL bundles which can be used to apply SSL
settings in a centralized way. An `SslBundle` can be registered with
an `SslBundleRegistry` and obtained from an `SslBundles` instance. The
`DefaultSslBundleRegistry` provides a default in-memory implementation.
Different client libraries often configure SSL in slightly different
ways. To accommodate this, the `SslBundle` provides a layered approach
of obtaining SSL information:
- `getStores` provides access to the key store and trust stores
as well as any required key store password.
- `getManagers` provides access to the `KeyManagerFactory`,
`TrustManagerFactory` as well as the `KeyManger` and
`TrustManager` arrays that they create.
- `createSslContext` provides a convenient way to obtain a new
`SSLContext` instance.
In addition, the `SslBundle` also provides details about the key being
used, the protocol to use and any options that should be applied to the
SSL engine.
See gh-34814
Prior to this commit, a failure to load a ConnectionDetailsFactory
caused startup to fail. This causes problems when some of a
factory's required classes were not available, for examle when using
spring-boot-docker-compose without Actuator.
Fixes gh-35100
This commit deprecates OAuth2ClientPropertiesRegistrationAdapter as
it wasn't really an adapter because it provides a static utility
method rather than adapting one contract to another. A replacement,
OAuth2ClientPropertiesMapper, is introduced that maps the OAuth2
client properties to the required types.
Closes gh-34714
This commit adds the following properties under
spring.security.oauth2.authorizationserver.client.[registration-id]:
* endpoint.device-authorization-uri
* endpoint.device-verification-uri
* token.device-code-time-to-live
See gh-34957
Redpanda (https://redpanda.com/) is Kafka-compatible and
Testcontainers provides a module. This commit adds support for
creating KafkaConnectionDetails from a
@ServiceConnection-annotated RedpandaContainer.
See gh-34780
Previously, FlywayProperties returned an empty string when its
password had not been set. This prevented the desired fallback to
JdbcConnectionDetails.
Fixes gh-35046
* gh-34833:
Polish "Add content buffering support to MockServerRestTemplateCustomizer"
Add content buffering support to MockServerRestTemplateCustomizer
Closes gh-34833
Update `up` and `start` operations so that real-time logging is
provided. Prior to this commit, lengthy pull operations were not
logged which gave the impression that the application had
crashed.
Closes gh-34994
Update `AbstractPackagerMojo` so that the docker-compose module
can be filtered from the packaged jar.
Co-authored-by: Phillip Webb <pwebb@vmware.com>
Co-authored-by: "Andy Wilkinson <wilkinsona@vmware.com>
Add auto-configuration for `Container` beans that are also
annotated with `@ServiceConnection`. This commit allow
testcontainers to be used at development time and a new section
has been added to the documentation to describe the feature.
Closes gh-35022
Add `TestcontainersLifecycleApplicationContextInitializer` and
`TestcontainersLifecycleBeanPostProcessor` to take care of starting and
stopping `Container` beans.
Closes gh-35021
Update restcontainers service connections support so that
technology specific `@ServiceConnector` annotations are not longer
required.
A single `@ServiceConnector` annotation can now be used to create
all `ConnectionDetail` beans.
Closes gh-35017
Update the auto-configuration gradle plugin so that the
configuration-properties plugin is not longer automatically applied.
This allows us to have auto-configuration modules that don't ship
configuration properties.
Closes gh-35028