準備工作完成了,那現(xiàn)在就開始創(chuàng)建第一個項目吧。
創(chuàng)建項目需要在命令行窗口進行,包括以后很多的操作都需要在命令行執(zhí)行。
建議先裝一個cmder,可以自己百度一下,后面有時間我整理個教程。進入項目根目錄(以后所有操作沒有特殊說明,都是在項目根目錄操作)。
執(zhí)行 yo jhipster (直接寫jhipster 一樣效果),會出來一堆說明,這個看看就好了,重點是選擇項目類型。

jhipster有兩種項目類型:獨立應(yīng)用 Monolithic application 和微服務(wù)模式的應(yīng)用(Microservice gateway、JHipster UAA server、Microservice application)。根據(jù)自己的需要選擇即可。
設(shè)置 Monolithic application項目
What is the base name of your application?? 項目名稱
What is your default Java package name? 包名
Do you want to use the JHipster Registry to configure, monitor and scale your application? 是否使用配置,監(jiān)控擴展應(yīng)用。如果選擇yes,需要單獨啟動JHipster Registry應(yīng)用。
設(shè)置認證方式
Which?type?of authentication would you like to use? 選擇什么樣的認證方式。這個問題依賴于之前的問題,如果選擇JHipster Registry只能使用JWT方式,就不會出現(xiàn)這個問題了。

????JWT authentication: use a?JSON Web Token (JWT), which is the default choice 。 JWT認證。
????OAuth 2.0 / OIDC Authentication: this uses an OpenID Connect server, like?Keycloak?or?Okta。使用第三方認證。
????HTTP Session Authentication: the classical session-based authentication mechanism, like we are used to do in Java (this is how most people use?Spring Security).? Session認證,使用的是Spring Security。
配置數(shù)據(jù)庫類型
Which?type?of database would you like to use? 選擇數(shù)據(jù)庫類型
????An SQL database (H2, MySQL, MariaDB, PostgreSQL, MSSQL, Oracle), which you will access with Spring Data JPA? 關(guān)系型數(shù)據(jù)庫。
如果選擇關(guān)系型數(shù)據(jù)庫需要繼續(xù)設(shè)置生產(chǎn)環(huán)境和開發(fā)環(huán)境。
Which?production?database would you like to use? 選擇生產(chǎn)環(huán)境數(shù)據(jù)庫類型,會影響src/main/resources/config/application-prod.yml 文件里的配置。如果使用Oracle數(shù)據(jù)庫,需要手工配置Oracle jdbc驅(qū)動

Which?development?database would you like to use??選擇生產(chǎn)環(huán)境數(shù)據(jù)庫類型,會影響src/main/resources/config/application-dev.yml 文件里的配置。

配置緩存
Do you want to use the Spring cache abstraction? 選擇是否使用緩存,以及緩存的類型。

?????ehcache?(local cache)本地緩存
?????Hazelcast?(distributed cache) 分布式緩存,不需要單獨配置,應(yīng)用會自己創(chuàng)建。如果要使用管理功能,需要單獨安裝管理工具,超過2個好像要收費
?????Infinispan?(another distributed cache) 另外一種分布式緩存。
? ? 不使用緩存,同時也會關(guān)閉hibernate 2級緩存。
Do you want to use Hibernate 2nd level cache? 是否可開啟hibernate 2級緩存,只有選擇關(guān)系型數(shù)據(jù)庫的時候才會出現(xiàn)這個問題。
配置使用maven還是Gradle
Would you like to use Maven or Gradle?
是否使用其他技術(shù)
Which other technologies would you like to use??

Social login (Google, Facebook, Twitter) 社會化登陸,國內(nèi)沒卵用。
Search engine using ElasticSearch 是否使用ElasticSearch 。如果選擇使用ElasticSearch,ElasticSearch只支持關(guān)系型數(shù)據(jù)庫,同時在代碼中需要解決一致性問題。jhipster在使用dev profile的時候會創(chuàng)建一個內(nèi)部的ElasticSearch。在生產(chǎn)環(huán)境中需要自行安裝配置ElasticSearch。
WebSockets using Spring Websocket 使用Websocket
API first development using swagger-codegen 使用API-First development
Asynchronous messages using Apache Kafka。使用Kafka,需要自行安裝。
其他設(shè)置
Which?Framework?would you like to use for the client? 選擇前端框架

Would you like to use the LibSass stylesheet preprocessor for your CSS? 添加libsass庫的時候出現(xiàn)問題,建議不用。是否使用LibSass
Would you like to enable internationalization support? 國際化支持,根據(jù)需要選擇就行了
Which testing frameworks would you like to use??選擇測試框架。
Would you like to install other generators from the JHipster Marketplace? 是否從市場安裝其他生成器,很多可能有兼容問題,建議都不用。