Skip to content

Commit

Permalink
Merge pull request #11506 from murdos/spring-boot-3.4-apps
Browse files Browse the repository at this point in the history
chore(deps): update generated apps to spring-boot 3.4.0
  • Loading branch information
pascalgrimaud authored Dec 6, 2024
2 parents 697ec0e + edb51d0 commit 8c40c11
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main/resources/generator/dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<jhlite.version>@project.version@</jhlite.version>
<!-- Dependencies -->
<logstash-logback-encoder.version>8.0</logstash-logback-encoder.version>
<spring-boot.version>3.3.5</spring-boot.version>
<spring-boot.version>3.4.0</spring-boot.version>
<spring-cloud.version>2023.0.4</spring-cloud.version>
<spring-cloud-netflix-eureka-client.version>4.2.0</spring-cloud-netflix-eureka-client.version>
<springdoc-openapi.version>2.6.0</springdoc-openapi.version>
<springdoc-openapi.version>2.7.0</springdoc-openapi.version>
<kafka-clients.version>3.9.0</kafka-clients.version>
<mongock.version>5.5.0</mongock.version>
<neo4j-migrations.version>2.15.0</neo4j-migrations.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Behind the scene, your last service will be recalled until the assertions are OK

## Mocking beans

You may need to mock beans for your component tests, but you won't be able to do it in a "classic" way (using `@MockBean`) since the application context will be already loaded. A way to achieve that is to overload beans to have mocks:
You may need to mock beans for your component tests, but you won't be able to do it in a "classic" way (using `@MockitoBean`) since the application context will be already loaded. A way to achieve that is to overload beans to have mocks:

```java
@ActiveProfiles("test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import {{packageName}}.shared.generation.domain.ExcludeFromGeneratedCodeCoverage;

@Configuration
@EnableConfigurationProperties({ LiquibaseProperties.class })
Expand All @@ -34,6 +37,7 @@ class LiquibaseConfiguration {
}

@Bean
@ExcludeFromGeneratedCodeCoverage(reason = "Not testing all liquibase properties configuration")
public SpringLiquibase liquibase(
@Qualifier("taskExecutor") Executor executor,
@LiquibaseDataSource ObjectProvider<DataSource> liquibaseDataSource,
Expand Down Expand Up @@ -62,14 +66,18 @@ class LiquibaseConfiguration {
);
}
liquibase.setChangeLog(liquibaseProperties.getChangeLog());
liquibase.setContexts(liquibaseProperties.getContexts());
if (!CollectionUtils.isEmpty(liquibaseProperties.getContexts())) {
liquibase.setContexts(StringUtils.collectionToCommaDelimitedString(liquibaseProperties.getContexts()));
}
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setLiquibaseSchema(liquibaseProperties.getLiquibaseSchema());
liquibase.setLiquibaseTablespace(liquibaseProperties.getLiquibaseTablespace());
liquibase.setDatabaseChangeLogLockTable(liquibaseProperties.getDatabaseChangeLogLockTable());
liquibase.setDatabaseChangeLogTable(liquibaseProperties.getDatabaseChangeLogTable());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
liquibase.setLabelFilter(liquibaseProperties.getLabelFilter());
if (!CollectionUtils.isEmpty(liquibaseProperties.getLabelFilter())) {
liquibase.setContexts(StringUtils.collectionToCommaDelimitedString(liquibaseProperties.getLabelFilter()));
}
liquibase.setChangeLogParameters(liquibaseProperties.getParameters());
liquibase.setRollbackFile(liquibaseProperties.getRollbackFile());
liquibase.setTestRollbackOnUpdate(liquibaseProperties.isTestRollbackOnUpdate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class SecurityConfiguration {
.contentSecurityPolicy(csp -> csp.policyDirectives(properties.getContentSecurityPolicy()))
.frameOptions(FrameOptionsConfig::deny)
.referrerPolicy(referrer -> referrer.policy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN))
.permissionsPolicy(permissions ->
.permissionsPolicyHeader(permissions ->
permissions.policy("camera=(), fullscreen=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=()"))
)
.formLogin(AbstractHttpConfigurer::disable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SecurityConfiguration {
.contentSecurityPolicy(csp -> csp.policyDirectives(applicationSecurityProperties.getContentSecurityPolicy()))
.frameOptions(FrameOptionsConfig::sameOrigin)
.referrerPolicy(referrer -> referrer.policy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN))
.permissionsPolicy(permissions ->
.permissionsPolicyHeader(permissions ->
permissions.policy("camera=(), fullscreen=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=()"))
)
.authorizeHttpRequests(authz -> authz
Expand Down Expand Up @@ -145,7 +145,7 @@ class SecurityConfiguration {
jwtDecoder.setClaimSetConverter(
new CustomClaimConverter(
clientRegistrationRepository.findByRegistrationId("oidc"),
restTemplateBuilder.setConnectTimeout(Duration.ofMillis(TIMEOUT)).setReadTimeout(Duration.ofMillis(TIMEOUT)).build()
restTemplateBuilder.connectTimeout(Duration.ofMillis(TIMEOUT)).readTimeout(Duration.ofMillis(TIMEOUT)).build()
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.gateway.handler.AsyncPredicate;
import org.springframework.cloud.gateway.handler.predicate.PathRoutePredicateFactory;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.reactive.server.FluxExchangeResult;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.web.server.ServerWebExchange;
Expand All @@ -35,10 +35,10 @@ import reactor.test.StepVerifier;
@AutoConfigureWebTestClient
class GatewayResourceIT {
@MockBean
@MockitoBean
private DiscoveryClient discoveryClient;
@MockBean
@MockitoBean
private RouteLocator routeLocator;
@Autowired
Expand Down

0 comments on commit 8c40c11

Please sign in to comment.