Skip to content

Commit

Permalink
Merge pull request #25317 from jhipster/spring-boot-3.2.3
Browse files Browse the repository at this point in the history
Upgrade to Spring Boot 3.2.3
  • Loading branch information
DanielFran committed Mar 1, 2024
2 parents 05ba864 + 095f291 commit 1e638ae
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 37 deletions.
2 changes: 1 addition & 1 deletion generators/cucumber/__snapshots__/generator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,4 @@ public class UserStepDefs extends StepDefs {
"stateCleared": "modified",
},
}
`;
`;
4 changes: 2 additions & 2 deletions generators/generator-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export const javaDependencies = {
/**
* spring-boot version should match the one managed by https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/JHIPSTER_DEPENDENCIES_VERSION
*/
'spring-boot': '3.2.2',
'spring-boot': '3.2.3',
/*
* hibernate version should match the one managed by https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/SPRING_BOOT_VERSION
* Required due to hibernate-jpamodelgen annotation processor.
*/
hibernate: '6.4.1.Final',
hibernate: '6.4.4.Final',
/*
* cassandra driver version should match the one managed by https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/SPRING_BOOT_VERSION
* Required due to java-driver-mapper-processor annotation processor.
Expand Down
7 changes: 2 additions & 5 deletions generators/server/templates/build.gradle.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,9 @@ dependencies {
<%_ if (searchEngineElasticsearch) { _%>
testImplementation "org.awaitility:awaitility:${awaitilityVersion}"
<%_ } _%>
<%_ if (databaseTypeSql) { _%>
<%_ if (databaseTypeSql && !reactive) { _%>
implementation "org.hibernate.orm:hibernate-core"
<%_ } _%>
<%_ if (databaseTypeSql) { _%>
annotationProcessor "org.hibernate.orm:hibernate-jpamodelgen:${hibernateVersion}"
<%_ } _%>
<%_ if (databaseTypeSql) { _%>
implementation "org.hibernate.validator:hibernate-validator"
<%_ } _%>
<%_ if (reactive) { _%>
Expand Down Expand Up @@ -317,6 +313,7 @@ if (addSpringMilestoneRepository) { _%>
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
implementation "org.springframework.boot:spring-boot-starter-data-r2dbc"
implementation "jakarta.persistence:jakarta.persistence-api"
<%_ } _%>
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-mail"
Expand Down
2 changes: 2 additions & 0 deletions generators/server/templates/gradle.properties.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ jhipsterDependenciesVersion=<%= jhipsterDependenciesVersion %>
# The spring-boot version should match the one managed by
# https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/<%= jhipsterDependenciesVersion %>
springBootVersion=<%- javaDependencies['spring-boot'] %>
<%_ if (databaseTypeSql && !reactive) { _%>
# The hibernate version should match the one managed by
# https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/<%- javaDependencies['spring-boot'] %> -->
hibernateVersion=<%- javaDependencies.hibernate %>
<%_ } _%>
mapstructVersion=<%- javaDependencies.mapstruct %>
archunitJunit5Version=<%- javaDependencies['archunit-junit5'] %>
<%_ if (enableSwaggerCodegen) { _%>
Expand Down
14 changes: 8 additions & 6 deletions generators/server/templates/gradle/profile_dev.gradle.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ sourceSets {
configurations {
all {
resolutionStrategy {
<%_ if (!reactive) { _%>
// TODO drop forced version. Refer to https://github.com/jhipster/generator-jhipster/issues/22579
force "org.hibernate.orm:hibernate-core:${hibernateVersion}"
<%_ if (enableHibernateCache && (cacheProviderEhcache || cacheProviderCaffeine || cacheProviderRedis)) { _%>
<%_ if (enableHibernateCache && (cacheProviderEhcache || cacheProviderCaffeine || cacheProviderRedis)) { _%>
// TODO drop forced version. Refer to https://github.com/jhipster/generator-jhipster/issues/22579
force "org.hibernate.orm:hibernate-jcache:${hibernateVersion}"
<%_ } _%>
<%_ if (prodDatabaseDriver?.r2dbc?.version) { _%>
<%_ } _%>
<%_ } _%>
<%_ if (prodDatabaseDriver?.r2dbc?.version) { _%>
force "<%- prodDatabaseDriver.r2dbc.groupId %>:<%- prodDatabaseDriver.r2dbc.artifactId %>:<%- prodDatabaseDriver.r2dbc.version %>"
<%_ } _%>
<%_ if (prodDatabaseDriver?.jdbc?.version) { _%>
<%_ } _%>
<%_ if (prodDatabaseDriver?.jdbc?.version) { _%>
force "<%- prodDatabaseDriver.jdbc.groupId %>:<%- prodDatabaseDriver.jdbc.artifactId %>:<%- prodDatabaseDriver.jdbc.version %>"
<%_ } _%>
<%_ } _%>
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions generators/server/templates/gradle/profile_prod.gradle.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ sourceSets {
configurations {
all {
resolutionStrategy {
<%_ if (!reactive) { _%>
// TODO drop forced version. Refer to https://github.com/jhipster/generator-jhipster/issues/22579
force "org.hibernate.orm:hibernate-core:${hibernateVersion}"
<%_ if (enableHibernateCache && (cacheProviderEhcache || cacheProviderCaffeine || cacheProviderRedis)) { _%>
<%_ if (enableHibernateCache && (cacheProviderEhcache || cacheProviderCaffeine || cacheProviderRedis)) { _%>
// TODO drop forced version. Refer to https://github.com/jhipster/generator-jhipster/issues/22579
force "org.hibernate.orm:hibernate-jcache:${hibernateVersion}"
<%_ } _%>
<%_ if (prodDatabaseDriver?.r2dbc?.version) { _%>
<%_ } _%>
<%_ } _%>
<%_ if (prodDatabaseDriver?.r2dbc?.version) { _%>
force "<%- prodDatabaseDriver.r2dbc.groupId %>:<%- prodDatabaseDriver.r2dbc.artifactId %>:<%- prodDatabaseDriver.r2dbc.version %>"
<%_ } _%>
<%_ if (prodDatabaseDriver?.jdbc?.version) { _%>
<%_ } _%>
<%_ if (prodDatabaseDriver?.jdbc?.version) { _%>
force "<%- prodDatabaseDriver.jdbc.groupId %>:<%- prodDatabaseDriver.jdbc.artifactId %>:<%- prodDatabaseDriver.jdbc.version %>"
<%_ } _%>
<%_ } _%>
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import com.nimbusds.jose.jwk.source.ImmutableSecret;
import com.nimbusds.jose.util.Base64;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -46,6 +48,8 @@ import org.springframework.security.oauth2.server.resource.web.DefaultBearerToke
@Configuration
public class SecurityJwtConfiguration {
private final Logger log = LoggerFactory.getLogger(SecurityJwtConfiguration.class);
@Value("${jhipster.security.authentication.jwt.base64-secret}")
private String jwtKey;
Expand All @@ -62,13 +66,22 @@ public class SecurityJwtConfiguration {
metersService.trackTokenExpired();
} else if (e.getMessage().contains("Failed to validate the token")) {
metersService.trackTokenInvalidSignature();
} else if (
e.getMessage().contains("Invalid JWT serialization:") ||
e.getMessage().contains("Invalid unsecured/JWS/JWE header:")
) {
metersService.trackTokenMalformed();
} else {
log.error("Unknown JWT reactive error {}", e.getMessage());
}
});
} catch (Exception e) {
if (e.getMessage().contains("An error occurred while attempting to decode the Jwt")) {
metersService.trackTokenMalformed();
} else if (e.getMessage().contains("Failed to validate the token")) {
metersService.trackTokenInvalidSignature();
} else {
log.error("Unknown JWT error {}", e.getMessage());
}
throw e;
}
Expand All @@ -86,6 +99,8 @@ public class SecurityJwtConfiguration {
e.getMessage().contains("Invalid unsecured/JWS/JWE")
) {
metersService.trackTokenMalformed();
} else {
log.error("Unknown JWT error {}", e.getMessage());
}
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,15 @@

package <%= packageName %>.config;

import org.neo4j.driver.Driver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
<%_ if (searchEngineElasticsearch) { _%>
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.elasticsearch.repository.config.Enable<% if (reactive) { %>Reactive<% } %>ElasticsearchRepositories;
import org.springframework.data.neo4j.repository.<% if (reactive) { %>Reactive<% } %>Neo4jRepository;
<%_ } _%>
import org.springframework.data.neo4j.core.<% if (reactive) { %>Reactive<% } %>DatabaseSelectionProvider;

import org.springframework.data.neo4j.core.transaction.<% if (reactive) { %>Reactive<% } %>Neo4jTransactionManager;
import org.springframework.data.neo4j.repository.config.Enable<% if (reactive) { %>Reactive<% } %>Neo4jRepositories;
import org.springframework.data.neo4j.repository.config.<% if (reactive) { %>Reactive<% } %>Neo4jRepositoryConfigurationExtension;

<%_ if (searchEngineElasticsearch) { _%>
import org.springframework.data.neo4j.repository.<% if (reactive) { %>Reactive<% } %>Neo4jRepository;
<%_ } _%>
import org.springframework.transaction.<% if (reactive) { %>Reactive<% } %>TransactionManager;

@Configuration
<%_ if (searchEngineElasticsearch) { _%>
Expand All @@ -47,10 +38,4 @@ import org.springframework.transaction.<% if (reactive) { %>Reactive<% } %>Trans
<%_ if (searchEngineElasticsearch) { _%>
@Enable<% if (reactive) { %>Reactive<% } %>ElasticsearchRepositories("<%= packageName %>.repository.search")
<%_ } _%>
public class DatabaseConfiguration {

@Bean(<% if (reactive) { %>Reactive<% } %>Neo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)
public <% if (reactive) { %>Reactive<% } %>TransactionManager transactionManager(Driver driver, <% if (reactive) { %>Reactive<% } %>DatabaseSelectionProvider databaseNameProvider) {
return new <% if (reactive) { %>Reactive<% } %>Neo4jTransactionManager(driver, databaseNameProvider);
}
}
public class DatabaseConfiguration {}

0 comments on commit 1e638ae

Please sign in to comment.