Window10環境下----JHipster安裝(一)
JHipster在w10系統下的安裝分兩種方式,在這我講的是官網給我們的安裝方式(包管理器安裝)
1、安裝Chocolatey
Chocolatey是一個Windows上的包管理器,聯合linux上的yum和apt—get類似。
點選這裡,官網上提供兩種方式,一種是在CMD中,一種是在PowerShell中,我使用的是CMD指令。首先找到cmd以管理者身份運作
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
出現這句話Chocolatey (choco.exe) is now ready證明Chocolatey安裝成功
2、安裝JHipster
還是在管理者身份下繼續運作
choco install jhipster
回車以後,他隻會提示Do you want to run the script?
這種提示,我們怎麼知道他要下載下傳什麼,終于他成功的下載下傳了所有的元件,包括我們有的(Node, Yarn, Yeoman, JDK 和 Git),如果我們電腦上有JDK 和 Git,或者不喜歡這種安裝方式的可以選擇第一種方式。
安裝成功後進行測試
重新打開cmd指令: yo jhipster
這就是安裝成功之後正确界面
建立應用時的問題
你選擇的問題答案不同可能會影響到接下來的問題顯示
-
Which type of application would you like to create?
Monolithic application: 單體應用
Microservice application: 微服務架構的service
Microservice gateway: 微服務網關,為微服務請求進行路由和安全
JHipster UAA server: 基于OAuth2的安全認證微服務,後文詳細解釋
-
What is the base name of your application?
你期望的應用的名稱
-
What is your default Java package name?
應用使用的預設包名,使用Yeoman的時候此值會被存儲,當下次使用的時候此值會成為預設值,可覆寫此值
-
Do you want to use the JHipster Registry to configure, monitor and scale your application?
JHipster Registry是一個開源的工具,用于管理你正在運作的應用(微服務注冊中心和統一配置中心),隻有在微服務架構時才會使用
-
Which type of authentication would you like to use?
所有可能的答案:
JWT authentication: 使用JSON Web Token
HTTP Session Authentication:經典的基于session認證的機制
OAuth 2.0 / OIDC Authentication: 使用OpenID連接配接服務,類似于Keycloak或者Okta
Authentication with JHipster UAA server: 此種方式必須提前生成JHipster UAA Server (Q1的選項),它是基于OAuth2的驗證服務
6. Which type of database would you like to use?
你可以選擇的選項:
No database,僅使用微服務架構時可用
An SQL database: 使用關系型資料庫,将會采用Spring data jpa
MongoDB
Cassandra
Couchbase
7. Which production database would you like to use?
選擇你線上環境使用的資料庫,此選項決定src/main/resources/config/application-prod.yml的配置
-
Which development database would you like to use?
此選項決定你src/main/resources/config/application-dev.ymlprofile的資料庫配置項,你可以選擇:
H2,running in-memory,資料存儲在記憶體中,服務停掉資料消失
H2,with its data stored on disk,資料存儲在硬碟,目前隻是BETA測試且不能在Windows機器上工作
可以和Q7的選項一緻
9. Do you want to use the Spring cache abstraction?
由于Spring對于Cache的允許使用者使用不同的cache實作,你可以使用chcache(本地緩存),Hazelcast(分布式緩存)或者Infinispan(另一種分布式緩存),此選項可以提升你的應用的性能
-
Do you want to use Hibernate 2nd level cache?
此選項僅當你選擇SQL資料庫并且在Q9選擇了一個緩存實作。Hibernate使用二級緩存可以更好的提升它的性能
-
Would you like to use Maven or Gradle?
建構此項目時将要使用的工具,Maven或者Gradle
-
Which other technologies would you like to use?
多選,你可以為你的應用添加多種技術,如:
Social login,社交登入功能
API first development using swagger-codegen:通過成swagger-codegen而使你的應用采用API優先的開發模式
Search engine using ElasticSearch: 對于ES的支援(Spring Data Elasticsearch)
Clustered HTTP sessions using Hazelcast,預設情況下,JHipster隻是用Http Session來存儲Spring Security的身份驗證和授權資訊。如果你在叢集中運作,使用HTTP Session将會導緻一些資料一緻的問題,如果你想在叢集中複制session,請選擇此項
13. WebSockets using Spring Websocket
啟用Websockets支援,将使用Spring WebSocket,JHipster提供了簡單的例子展示如和高效的使用
-
Asynchronous messages using Apache Kafka
是否使用Kafka來釋出和訂閱消息
-
Which Framework would you like to use for the client?
選擇使用那種用戶端技術:
Angular version 4+
AngularJS version 1.x
16. Would you like to use the LibSass stylesheet preprocessor for your CSS?
Node-sass對于設計CSS是一個優秀的解決方案,便于高效使用,你需要運作一個Gulp服務,jhipster會自動配置
-
Would you like to enable internationalization support?
JHipster對于國際支援非常友好,你可以在用戶端和服務端使用。但一般對于國際化要求不多的場景,可以不選擇。
-
Which testing frameworks would you like to use?
預設Jhipster提供了Java單元/內建測試(spring`s Junit)和JavaScript單元測試(Karma.js),你也可以選擇:
Performance tests using Gatling,性能測試 Gatling
Behaviour tests using Cucumber,行為測試 Cucumber
Angular integration tests with Protractor, angular內建測試Protractor
19. Would you like to install other generators from the JHipster Marketplace?
是否需要去JHipster商城安裝第三方插件子產品