generator-jhipster: Compilation error in Gateway application not using Reactive
Overview of the issue
After generating a new Gateway application with reactive = false
There’s a compilation error on GatewayResource.java
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project xrp-gateway: Compilation failure
[ERROR] /C:/Users/xxxxxxxxxxx/xxxx/appgateway/web/rest/GatewayResource.java:[52,49] cannot find symbol
[ERROR] symbol: variable appName
[ERROR] location: class com.xrp.appgateway.web.rest.GatewayResource
Suggest a Fix
Check this commit: 6126a05,
In the file, generators/server/templates/src/main/java/package/web/rest/GatewayResource.java.ejs the variable appName is not declared when reactive is false:
<%_ if (reactive) { _%>
@Value("${spring.application.name}")
private String appName;
<%_ } _%>
But it’s still used later in the code regardless of the value of reactive:
if (!serviceId.equalsIgnoreCase(appName)) {
routeVM.setServiceInstances(discoveryClient.getInstances(serviceId));
routeVMs.add(routeVM);
}
JHipster Version(s)
Regression since 7.0.0 - Works @ 6.10.5
JHipster configuration
.yo-rc.json file
{
"generator-jhipster": {
"blueprints": [],
"otherModules": [],
"applicationType": "gateway",
"baseName": "XrpGateway",
"jhipsterVersion": "7.0.1",
"skipClient": false,
"skipServer": false,
"skipUserManagement": true,
"skipCheckLengthOfIdentifier": false,
"skipFakeData": false,
"jhiPrefix": "xrp",
"entitySuffix": "",
"dtoSuffix": "DTO",
"testFrameworks": ["cypress"],
"pages": [],
"creationTimestamp": 1620857463720,
"serviceDiscoveryType": "consul",
"reactive": false,
"authenticationType": "jwt",
"packageName": "com.xrp.appgateway",
"serverPort": "8080",
"cacheProvider": "no",
"enableHibernateCache": false,
"databaseType": "sql",
"devDatabaseType": "h2Memory",
"prodDatabaseType": "postgresql",
"buildTool": "maven",
"serverSideOptions": ["messageBroker:kafka"],
"websocket": false,
"searchEngine": false,
"messageBroker": "kafka",
"enableSwaggerCodegen": false,
"clientFramework": "angularX",
"withAdminUi": true,
"clientTheme": "none",
"enableTranslation": false,
"nativeLanguage": "en",
"packageFolder": "com/xrp/appgateway",
"clientPackageManager": "npm",
"clientThemeVariant": "",
"languages": ["en", "fr"],
"jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons"
}
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
No entities yet
Browsers and Operating System
Not relevent
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (16 by maintainers)
Seems like everything is clear now.