From 57f8fd68d62e0412210febd92178f909f09a1628 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Sun, 25 Feb 2024 16:37:17 -0700 Subject: [PATCH 01/10] Upgrade to Spring Boot 3.2.3 --- .github/actions/setup/action.yml | 2 +- generators/cucumber/__snapshots__/generator.spec.ts.snap | 2 +- generators/generator-constants.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index d78237e048bf..5bb2215a4141 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -67,7 +67,7 @@ inputs: jhipster-bom-branch: description: 'JHipster BOM branch' required: false - default: auto + default: dependabot/maven/org.springframework.boot-spring-boot-dependencies-3.2.3 jhipster-bom-directory: description: 'JHipster BOM path' required: false diff --git a/generators/cucumber/__snapshots__/generator.spec.ts.snap b/generators/cucumber/__snapshots__/generator.spec.ts.snap index b1d26b2f41ba..a797648b8bf2 100644 --- a/generators/cucumber/__snapshots__/generator.spec.ts.snap +++ b/generators/cucumber/__snapshots__/generator.spec.ts.snap @@ -338,4 +338,4 @@ public class UserStepDefs extends StepDefs { "stateCleared": "modified", }, } -`; \ No newline at end of file +`; diff --git a/generators/generator-constants.js b/generators/generator-constants.js index f2654e3aa749..e2db95f91c02 100644 --- a/generators/generator-constants.js +++ b/generators/generator-constants.js @@ -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. From 127bc901ee20f314a99a9b2338debfc01bcb3245 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Mon, 26 Feb 2024 19:27:26 -0300 Subject: [PATCH 02/10] adjust jwt security meter. --- .../config/SecurityJwtConfiguration.java.ejs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/generators/server/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs b/generators/server/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs index 5cdcbf04c016..42e2af704a58 100644 --- a/generators/server/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs +++ b/generators/server/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs @@ -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; @@ -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; @@ -62,6 +66,13 @@ 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) { @@ -69,6 +80,8 @@ public class SecurityJwtConfiguration { metersService.trackTokenMalformed(); } else if (e.getMessage().contains("Failed to validate the token")) { metersService.trackTokenInvalidSignature(); + } else { + log.error("Unknown JWT error {}", e.getMessage()); } throw e; } @@ -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; } From 88a5a8e8a3a0490e157a957ea2c5b405409bbb75 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Thu, 29 Feb 2024 19:41:46 -0300 Subject: [PATCH 03/10] rely on auto config for Neo4j TransactionManager --- .../DatabaseConfiguration.java_neo4j.ejs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/generators/spring-data-neo4j/templates/src/main/java/_package_/config/DatabaseConfiguration.java_neo4j.ejs b/generators/spring-data-neo4j/templates/src/main/java/_package_/config/DatabaseConfiguration.java_neo4j.ejs index 1be1aae131f0..fe262e2bec72 100644 --- a/generators/spring-data-neo4j/templates/src/main/java/_package_/config/DatabaseConfiguration.java_neo4j.ejs +++ b/generators/spring-data-neo4j/templates/src/main/java/_package_/config/DatabaseConfiguration.java_neo4j.ejs @@ -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) { _%> @@ -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 {} From 3e4e37a0de58c67287e32923110484f0651ed544 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Thu, 29 Feb 2024 20:13:43 -0300 Subject: [PATCH 04/10] add conditional to hibernateVersion in gradle.properties.ejs --- generators/server/templates/gradle.properties.ejs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generators/server/templates/gradle.properties.ejs b/generators/server/templates/gradle.properties.ejs index d51376d35708..e97696cadcd3 100644 --- a/generators/server/templates/gradle.properties.ejs +++ b/generators/server/templates/gradle.properties.ejs @@ -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) { _%> # 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) { _%> From 26a37d2b2d0ea6405f8f502bc8d05b9f78c4d711 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Thu, 29 Feb 2024 20:32:11 -0300 Subject: [PATCH 05/10] adjust hibernate version --- generators/server/templates/gradle.properties.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/server/templates/gradle.properties.ejs b/generators/server/templates/gradle.properties.ejs index e97696cadcd3..c0ceee01a2df 100644 --- a/generators/server/templates/gradle.properties.ejs +++ b/generators/server/templates/gradle.properties.ejs @@ -24,7 +24,7 @@ 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) { _%> +<%_ 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 %> From 389ef6ce55841318859f87e85e350ff9881dca35 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Thu, 29 Feb 2024 20:59:46 -0300 Subject: [PATCH 06/10] Update profile_dev.gradle.ejs --- .../server/templates/gradle/profile_dev.gradle.ejs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/generators/server/templates/gradle/profile_dev.gradle.ejs b/generators/server/templates/gradle/profile_dev.gradle.ejs index 349f228af081..7b3266826c1c 100644 --- a/generators/server/templates/gradle/profile_dev.gradle.ejs +++ b/generators/server/templates/gradle/profile_dev.gradle.ejs @@ -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 %>" -<%_ } _%> + <%_ } _%> } } } From b4c0d2c2b40af128d4c33956ebfaff408310bdfd Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Thu, 29 Feb 2024 21:00:59 -0300 Subject: [PATCH 07/10] Update profile_prod.gradle.ejs --- .../templates/gradle/profile_prod.gradle.ejs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/generators/server/templates/gradle/profile_prod.gradle.ejs b/generators/server/templates/gradle/profile_prod.gradle.ejs index 6e16b6224bfb..18f58be621b3 100644 --- a/generators/server/templates/gradle/profile_prod.gradle.ejs +++ b/generators/server/templates/gradle/profile_prod.gradle.ejs @@ -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 %>" -<%_ } _%> + <%_ } _%> } } } From 5a1dcf52e86d96af8574acc3fd638f7160c70aa1 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Thu, 29 Feb 2024 23:02:59 -0300 Subject: [PATCH 08/10] Update build.gradle.ejs --- generators/server/templates/build.gradle.ejs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/generators/server/templates/build.gradle.ejs b/generators/server/templates/build.gradle.ejs index f556e52c3624..30bb6ce9fbeb 100644 --- a/generators/server/templates/build.gradle.ejs +++ b/generators/server/templates/build.gradle.ejs @@ -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) { _%> From 13753ff551383826e88fa0cd2fa36b9121487a60 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Fri, 1 Mar 2024 06:36:53 -0300 Subject: [PATCH 09/10] Update build.gradle.ejs --- generators/server/templates/build.gradle.ejs | 1 + 1 file changed, 1 insertion(+) diff --git a/generators/server/templates/build.gradle.ejs b/generators/server/templates/build.gradle.ejs index 30bb6ce9fbeb..7eceecedf360 100644 --- a/generators/server/templates/build.gradle.ejs +++ b/generators/server/templates/build.gradle.ejs @@ -313,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" From 095f2919ee4bd5df6a0eb5cdb60dd109917f69d6 Mon Sep 17 00:00:00 2001 From: Daniel Franco Date: Fri, 1 Mar 2024 14:28:25 +0000 Subject: [PATCH 10/10] Use default jhipster-bom branch --- .github/actions/setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 5bb2215a4141..d78237e048bf 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -67,7 +67,7 @@ inputs: jhipster-bom-branch: description: 'JHipster BOM branch' required: false - default: dependabot/maven/org.springframework.boot-spring-boot-dependencies-3.2.3 + default: auto jhipster-bom-directory: description: 'JHipster BOM path' required: false