@@ -21,17 +21,9 @@ import chalk from 'chalk';
2121import { lowerFirst , sortedUniqBy } from 'lodash-es' ;
2222import { isFileStateModified } from 'mem-fs-editor/state' ;
2323
24- import { APPLICATION_TYPE_GATEWAY , APPLICATION_TYPE_MICROSERVICE } from '../../lib/core/application-types.ts' ;
24+ import { APPLICATION_TYPE_MICROSERVICE } from '../../lib/core/application-types.ts' ;
2525import type { FieldType } from '../../lib/jhipster/field-types.ts' ;
26- import {
27- cacheTypes ,
28- databaseTypes ,
29- fieldTypes ,
30- messageBrokerTypes ,
31- searchEngineTypes ,
32- testFrameworkTypes ,
33- websocketTypes ,
34- } from '../../lib/jhipster/index.ts' ;
26+ import { cacheTypes , databaseTypes , fieldTypes , searchEngineTypes , testFrameworkTypes , websocketTypes } from '../../lib/jhipster/index.ts' ;
3527import { mutateData } from '../../lib/utils/index.ts' ;
3628import BaseApplicationGenerator from '../base-application/index.ts' ;
3729import { createNeedleCallback , isWin32 } from '../base-core/support/index.ts' ;
@@ -67,7 +59,6 @@ import type {
6759const { CAFFEINE , EHCACHE , HAZELCAST , INFINISPAN , MEMCACHED , REDIS } = cacheTypes ;
6860const { NO : NO_WEBSOCKET , SPRING_WEBSOCKET } = websocketTypes ;
6961const { CASSANDRA , COUCHBASE , MONGODB , NEO4J , SQL } = databaseTypes ;
70- const { KAFKA , PULSAR } = messageBrokerTypes ;
7162const { ELASTICSEARCH } = searchEngineTypes ;
7263
7364const { BYTES : TYPE_BYTES , BYTE_BUFFER : TYPE_BYTE_BUFFER } = fieldTypes . RelationalOnlyDBTypes ;
@@ -159,6 +150,7 @@ export default class SpringBootGenerator extends SpringBootApplicationGenerator
159150 testFrameworks,
160151 feignClient,
161152 enableSwaggerCodegen,
153+ serviceDiscoveryType,
162154 } = this . jhipsterConfigWithDefaults ;
163155 const { cacheProvider } = this . jhipsterConfigWithDefaults as SpringCacheConfig ;
164156 const { messageBroker } = this . jhipsterConfigWithDefaults ;
@@ -184,8 +176,8 @@ export default class SpringBootGenerator extends SpringBootApplicationGenerator
184176 await this . composeWithJHipster ( 'jhipster:java-simple-application:openapi-generator' ) ;
185177 }
186178
187- if ( applicationType === APPLICATION_TYPE_GATEWAY ) {
188- await this . composeWithJHipster ( 'jhipster:spring-cloud:gateway ' ) ;
179+ if ( applicationType !== 'monolith' || messageBroker !== 'no' || serviceDiscoveryType !== 'no' ) {
180+ await this . composeWithJHipster ( 'jhipster:spring-cloud' ) ;
189181 }
190182
191183 if ( testFrameworks ?. includes ( CUCUMBER ) ) {
@@ -209,9 +201,6 @@ export default class SpringBootGenerator extends SpringBootApplicationGenerator
209201 } else if ( databaseType === NEO4J ) {
210202 await this . composeWithJHipster ( 'jhipster:spring-data:neo4j' ) ;
211203 }
212- if ( messageBroker === KAFKA || messageBroker === PULSAR ) {
213- await this . composeWithJHipster ( `jhipster:spring-cloud:${ messageBroker } ` ) ;
214- }
215204 if ( searchEngine === ELASTICSEARCH ) {
216205 await this . composeWithJHipster ( 'jhipster:spring-data:elasticsearch' ) ;
217206 }
@@ -784,14 +773,7 @@ ${classProperties
784773 ) ;
785774 } ,
786775 addJHipsterBomDependencies ( { application, source } ) {
787- const {
788- applicationTypeGateway,
789- applicationTypeMicroservice,
790- javaDependencies,
791- jhipsterDependenciesVersion,
792- messageBrokerAny,
793- serviceDiscoveryAny,
794- } = application ;
776+ const { jhipsterDependenciesVersion } = application ;
795777
796778 if ( application . reactive && application . graalvmSupport ) {
797779 source . addNativeHint ! ( {
@@ -802,32 +784,18 @@ ${classProperties
802784 ] ,
803785 } ) ;
804786 }
805- source . addJavaDefinitions ?.(
806- {
807- dependencies : [ { groupId : 'tech.jhipster' , artifactId : 'jhipster-framework' , version : jhipsterDependenciesVersion ! } ] ,
808- mavenDefinition : {
809- properties : [
810- {
811- property : 'spring-boot.version' ,
812- // eslint-disable-next-line no-template-curly-in-string
813- value : '${project.parent.version}' ,
814- } ,
815- ] ,
816- } ,
817- } ,
818- {
819- condition : applicationTypeGateway || applicationTypeMicroservice || serviceDiscoveryAny || messageBrokerAny ,
820- dependencies : [
787+ source . addJavaDefinitions ?.( {
788+ dependencies : [ { groupId : 'tech.jhipster' , artifactId : 'jhipster-framework' , version : jhipsterDependenciesVersion ! } ] ,
789+ mavenDefinition : {
790+ properties : [
821791 {
822- groupId : 'org.springframework.cloud' ,
823- artifactId : 'spring-cloud-dependencies' ,
824- type : 'pom' ,
825- scope : 'import' ,
826- version : javaDependencies ! [ 'spring-cloud-dependencies' ] ,
792+ property : 'spring-boot.version' ,
793+ // eslint-disable-next-line no-template-curly-in-string
794+ value : '${project.parent.version}' ,
827795 } ,
828796 ] ,
829797 } ,
830- ) ;
798+ } ) ;
831799 } ,
832800 addSpringdoc ( { application, source } ) {
833801 const springdocDependency = `springdoc-openapi-starter-${ application . reactive ? 'webflux' : 'webmvc' } -api` ;
@@ -1025,34 +993,6 @@ ${application.jhipsterDependenciesVersion?.includes('-CICD') ? '' : '// '}mavenL
1025993 condition : application . addSpringMilestoneRepository ,
1026994 dependencies : [ { groupId : 'org.springframework.boot' , artifactId : 'spring-boot-properties-migrator' , scope : 'runtime' } ] ,
1027995 } ,
1028- {
1029- condition : application . applicationTypeMicroservice || application . applicationTypeGateway ,
1030- dependencies : [
1031- { groupId : 'org.springframework.cloud' , artifactId : 'spring-cloud-starter' } ,
1032- {
1033- groupId : 'org.springframework.cloud' ,
1034- artifactId : `spring-cloud-starter-circuitbreaker-${ application . reactive ? 'reactor-' : '' } resilience4j` ,
1035- } ,
1036- ] ,
1037- } ,
1038- {
1039- condition : application . serviceDiscoveryAny ,
1040- dependencies : [ { groupId : 'org.springframework.cloud' , artifactId : 'spring-cloud-starter-bootstrap' } ] ,
1041- } ,
1042- {
1043- condition : application . serviceDiscoveryEureka ,
1044- dependencies : [
1045- { groupId : 'org.springframework.cloud' , artifactId : 'spring-cloud-starter-config' } ,
1046- { groupId : 'org.springframework.cloud' , artifactId : 'spring-cloud-starter-netflix-eureka-client' } ,
1047- ] ,
1048- } ,
1049- {
1050- condition : application . serviceDiscoveryConsul ,
1051- dependencies : [
1052- { groupId : 'org.springframework.cloud' , artifactId : 'spring-cloud-starter-consul-config' } ,
1053- { groupId : 'org.springframework.cloud' , artifactId : 'spring-cloud-starter-consul-discovery' } ,
1054- ] ,
1055- } ,
1056996 ) ;
1057997
1058998 if ( application . buildToolGradle && application . reactive ) {
0 commit comments