mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Merge pull request #35872 from izeye
* pr/35872: Polish Closes gh-35872
This commit is contained in:
commit
c652a3028a
@ -649,12 +649,12 @@ public class KafkaProperties {
|
|||||||
private final Map<String, String> properties = new HashMap<>();
|
private final Map<String, String> properties = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The close timeout.
|
* Close timeout.
|
||||||
*/
|
*/
|
||||||
private Duration closeTimeout;
|
private Duration closeTimeout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The operation timeout.
|
* Operation timeout.
|
||||||
*/
|
*/
|
||||||
private Duration operationTimeout;
|
private Duration operationTimeout;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
public class SessionAutoConfigurationEarlyInitializationIntegrationTests {
|
class SessionAutoConfigurationEarlyInitializationIntegrationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void configurationIsFrozenWhenSessionRepositoryAccessed() {
|
void configurationIsFrozenWhenSessionRepositoryAccessed() {
|
||||||
|
@ -141,9 +141,10 @@ Open your favorite text editor and add the following:
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.springframework.boot' version '{spring-boot-version}'
|
id 'org.springframework.boot' version '{spring-boot-version}'
|
||||||
id 'io.spring.dependency-management' version '1.1.0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'io.spring.dependency-management'
|
||||||
|
|
||||||
group = 'com.example'
|
group = 'com.example'
|
||||||
version = '0.0.1-SNAPSHOT'
|
version = '0.0.1-SNAPSHOT'
|
||||||
sourceCompatibility = '17'
|
sourceCompatibility = '17'
|
||||||
@ -247,7 +248,7 @@ If you run `gradle dependencies` again, you see that there are now a number of a
|
|||||||
[[getting-started.first-application.code]]
|
[[getting-started.first-application.code]]
|
||||||
=== Writing the Code
|
=== Writing the Code
|
||||||
To finish our application, we need to create a single Java file.
|
To finish our application, we need to create a single Java file.
|
||||||
By default, Maven and Gradle compiles sources from `src/main/java`, so you need to create that directory structure and then add a file named `src/main/java/MyApplication.java` to contain the following code:
|
By default, Maven and Gradle compile sources from `src/main/java`, so you need to create that directory structure and then add a file named `src/main/java/MyApplication.java` to contain the following code:
|
||||||
|
|
||||||
include::code:MyApplication[]
|
include::code:MyApplication[]
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ For JWT configuration, a JWK Set URI or OIDC Issuer URI needs to be specified, a
|
|||||||
NOTE: If the authorization server does not support a JWK Set URI, you can configure the resource server with the Public Key used for verifying the signature of the JWT.
|
NOTE: If the authorization server does not support a JWK Set URI, you can configure the resource server with the Public Key used for verifying the signature of the JWT.
|
||||||
This can be done using the configprop:spring.security.oauth2.resourceserver.jwt.public-key-location[] property, where the value needs to point to a file containing the public key in the PEM-encoded x509 format.
|
This can be done using the configprop:spring.security.oauth2.resourceserver.jwt.public-key-location[] property, where the value needs to point to a file containing the public key in the PEM-encoded x509 format.
|
||||||
|
|
||||||
The configprop:spring.security.oauth2.resourceserver.jwt.audiences[] property can be used to specifify the expected values of the aud claim in JWTs.
|
The configprop:spring.security.oauth2.resourceserver.jwt.audiences[] property can be used to specify the expected values of the aud claim in JWTs.
|
||||||
For example, to require JWTs to contain an aud claim with the value `my-audience`:
|
For example, to require JWTs to contain an aud claim with the value `my-audience`:
|
||||||
|
|
||||||
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
|
||||||
|
@ -29,7 +29,7 @@ import org.springframework.core.annotation.Order;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link BeanFactoryPostProcessor} to prevent {@link AutoCloseable} destruction calls so
|
* {@link BeanFactoryPostProcessor} to prevent {@link AutoCloseable} destruction calls so
|
||||||
* that {@link TestcontainersLifecycleBeanFactoryPostProcessor} can be smarter about which
|
* that {@link TestcontainersLifecycleBeanPostProcessor} can be smarter about which
|
||||||
* containers to close.
|
* containers to close.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
@ -56,7 +56,7 @@ class TestcontainersLifecycleBeanPostProcessor implements DestructionAwareBeanPo
|
|||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(TestcontainersLifecycleBeanPostProcessor.class);
|
private static final Log logger = LogFactory.getLog(TestcontainersLifecycleBeanPostProcessor.class);
|
||||||
|
|
||||||
private ConfigurableListableBeanFactory beanFactory;
|
private final ConfigurableListableBeanFactory beanFactory;
|
||||||
|
|
||||||
private volatile boolean containersInitialized = false;
|
private volatile boolean containersInitialized = false;
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ import static org.mockito.Mockito.never;
|
|||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link TestcontainersLifecycleApplicationContextInitializer} and
|
* Tests for {@link TestcontainersLifecycleApplicationContextInitializer},
|
||||||
* {@link TestcontainersLifecycleBeanPostProcessor} and
|
* {@link TestcontainersLifecycleBeanPostProcessor}, and
|
||||||
* {@link TestcontainersLifecycleBeanFactoryPostProcessor}.
|
* {@link TestcontainersLifecycleBeanFactoryPostProcessor}.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
@ -39,8 +39,8 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
|||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests for {@link TestcontainersLifecycleApplicationContextInitializer} to
|
* Integration tests for {@link TestcontainersLifecycleBeanPostProcessor} to ensure create
|
||||||
* ensure create and destroy events happen in the correct order.
|
* and destroy events happen in the correct order.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
@ContextConfiguration(classes = { TestConfig.class, ContainerConfig.class })
|
@ContextConfiguration(classes = { TestConfig.class, ContainerConfig.class })
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
@DisabledIfDockerUnavailable
|
@DisabledIfDockerUnavailable
|
||||||
public class TestcontainersLifecycleOrderIntegrationTests {
|
class TestcontainersLifecycleOrderIntegrationTests {
|
||||||
|
|
||||||
static List<String> events = Collections.synchronizedList(new ArrayList<>());
|
static List<String> events = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class ServiceConnectionContextCustomizerTests {
|
|||||||
ServiceConnectionContextCustomizer n3 = new ServiceConnectionContextCustomizer(
|
ServiceConnectionContextCustomizer n3 = new ServiceConnectionContextCustomizer(
|
||||||
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "namex",
|
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "namex",
|
||||||
annotation1, () -> container1)));
|
annotation1, () -> container1)));
|
||||||
assertThat(n1.hashCode()).isEqualTo(n2.hashCode());
|
assertThat(n1.hashCode()).isEqualTo(n2.hashCode()).isNotEqualTo(n3.hashCode());
|
||||||
assertThat(n1).isEqualTo(n2).isNotEqualTo(n3);
|
assertThat(n1).isEqualTo(n2).isNotEqualTo(n3);
|
||||||
// Connection Details Types
|
// Connection Details Types
|
||||||
ServiceConnectionContextCustomizer t1 = new ServiceConnectionContextCustomizer(
|
ServiceConnectionContextCustomizer t1 = new ServiceConnectionContextCustomizer(
|
||||||
@ -122,7 +122,7 @@ class ServiceConnectionContextCustomizerTests {
|
|||||||
ServiceConnectionContextCustomizer t3 = new ServiceConnectionContextCustomizer(
|
ServiceConnectionContextCustomizer t3 = new ServiceConnectionContextCustomizer(
|
||||||
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "name",
|
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "name",
|
||||||
annotation3, () -> container1)));
|
annotation3, () -> container1)));
|
||||||
assertThat(t1.hashCode()).isEqualTo(t2.hashCode());
|
assertThat(t1.hashCode()).isEqualTo(t2.hashCode()).isNotEqualTo(t3.hashCode());
|
||||||
assertThat(t1).isEqualTo(t2).isNotEqualTo(t3);
|
assertThat(t1).isEqualTo(t2).isNotEqualTo(t3);
|
||||||
// Container
|
// Container
|
||||||
ServiceConnectionContextCustomizer c1 = new ServiceConnectionContextCustomizer(
|
ServiceConnectionContextCustomizer c1 = new ServiceConnectionContextCustomizer(
|
||||||
@ -134,7 +134,7 @@ class ServiceConnectionContextCustomizerTests {
|
|||||||
ServiceConnectionContextCustomizer c3 = new ServiceConnectionContextCustomizer(
|
ServiceConnectionContextCustomizer c3 = new ServiceConnectionContextCustomizer(
|
||||||
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "name",
|
List.of(new ContainerConnectionSource<>("test", this.origin, PostgreSQLContainer.class, "name",
|
||||||
annotation1, () -> container2)));
|
annotation1, () -> container2)));
|
||||||
assertThat(c1.hashCode()).isEqualTo(c2.hashCode());
|
assertThat(c1.hashCode()).isEqualTo(c2.hashCode()).isNotEqualTo(c3.hashCode());
|
||||||
assertThat(c1).isEqualTo(c2).isNotEqualTo(c3);
|
assertThat(c1).isEqualTo(c2).isNotEqualTo(c3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user