Open flyliu33 opened 1 month ago
JHipster has completed the sample check
.yo-rc.json
: blank
Entities JDL: blank
Application: successfully generated
Frontend check: skipped
Backend check: skipped
E2E check: skipped
This check uses jhipster info
output from the issue description to generate the sample.
Bug report that does not contain this information will be marked as invalid.
I tried generating apps from your JDL. I was able to run mvn compile
in each project without issues. I did see errors when running mvn verify
. What do you mean when you say the Redis code is not generated properly?
As usual for a monolithic project created by jhipster, it would create a redis docker compose file and some relevant redis codes in the project while choosing redis as cacheProvider by jhipster
command. But while I set redis as cacheProvider
for one service in a jdl file, the above attachment as a example, it cannot generate the redis docker compose file and the redis relevant codes. But jhipster jdl
can create a kafka docker compose file and the relevant kafka codes while setting kafka as messageBroker in the jdl file. I am not sure if I misunderstood the principle of jhipster, if yes, please explain to me, thanks!
I tried generating a monolith with the CLI and choosing Redis for the cache provider. It creates Docker Compose YAML files just fine. Here's the .yo-rc.json
:
{
"generator-jhipster": {
"applicationType": "monolith",
"authenticationType": "jwt",
"baseName": "redis",
"buildTool": "maven",
"cacheProvider": "redis",
"clientFramework": "angular",
"clientTestFrameworks": [],
"clientTheme": "none",
"creationTimestamp": 1730211299066,
"databaseType": "sql",
"devDatabaseType": "postgresql",
"devServerPort": 4200,
"enableHibernateCache": true,
"enableSwaggerCodegen": false,
"enableTranslation": true,
"entities": [],
"feignClient": null,
"jhipsterVersion": "8.7.2",
"languages": ["en"],
"messageBroker": false,
"microfrontend": null,
"microfrontends": [],
"nativeLanguage": "en",
"packageName": "com.mycompany.myapp",
"prodDatabaseType": "postgresql",
"reactive": false,
"searchEngine": false,
"serverPort": null,
"serverSideOptions": [],
"serviceDiscoveryType": false,
"syncUserWithIdp": null,
"testFrameworks": [],
"websocket": false,
"withAdminUi": true
}
}
$ ll src/main/docker
total 64
-rw-r--r--@ 1 mraible staff 991B Oct 29 08:15 app.yml
drwxr-xr-x@ 3 mraible staff 96B Oct 29 08:15 grafana
-rw-r--r--@ 1 mraible staff 3.1K Oct 29 08:15 jhipster-control-center.yml
drwxr-xr-x@ 3 mraible staff 96B Oct 29 08:15 jib
-rw-r--r--@ 1 mraible staff 1.3K Oct 29 08:15 monitoring.yml
-rw-r--r--@ 1 mraible staff 654B Oct 29 08:15 postgresql.yml
drwxr-xr-x@ 3 mraible staff 96B Oct 29 08:15 prometheus
drwxr-xr-x@ 4 mraible staff 128B Oct 29 08:15 redis
-rw-r--r--@ 1 mraible staff 1.8K Oct 29 08:15 redis-cluster.yml
-rw-r--r--@ 1 mraible staff 306B Oct 29 08:15 redis.yml
-rw-r--r--@ 1 mraible staff 286B Oct 29 08:15 services.yml
-rw-r--r--@ 1 mraible staff 656B Oct 29 08:15 sonar.yml
If I change the JDL to have reactive: true
, it forces the Hibernate cache to be false and the following is printed when I generate the app.
INFO! Disabling hibernate cache for cache provider no
This is because the Spring Cache generator disables caching for reactive apps.
We didn't implement caching for reactive apps because it wasn't supported by Spring WebFlux when we implemented it. See https://github.com/jhipster/generator-jhipster/pull/10107.
If you change your app to have reactive: false
, it should work.
Setting rective: false
can work for me. Despite spring webflux doesn't work with hibernate 2nd cache compatibly, there seem to be other alternative caching solutions, like ReactiveRedisTemplate. I am not sure if it's suitable for Jhipster, just my opinion.
Overview of the issue
I try to generate a project based on a official sample jdl file with a slight modify, everything works well but redis. the code of redis cannot be generated properly.
Motivation for or Use Case
Reproduce the error
microservice-ecommerce-reactive.txt
jhipster jdl .\microservice-ecommerce-reactive.jdl
Related issues
Suggest a Fix
JHipster Version(s)
v8.7.1
JHipster configuration
.yo-rc.json file for invoice
.yo-rc.json file for notification
.yo-rc.json file for store
.yo-rc.json file for product
Browsers and Operating System
Edition Windows 11 Pro Version 23H2 Installed on 8/19/2024 OS build 22631.4317 Experience Windows Feature Experience Pack 1000.22700.1041.0