Window10环境下----JHipster安装(一)

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
在这里插入图片描述这就是安装成功之后正确界面

创建应用时的问题

你选择的问题答案不同可能会影响到接下来的问题显示

  1. Which type of application would you like to create?
    Monolithic application: 单体应用
    Microservice application: 微服务架构的service
    Microservice gateway: 微服务网关,为微服务请求进行路由和安全
    JHipster UAA server: 基于OAuth2的安全认证微服务,后文详细解释

  2. What is the base name of your application?
    你期望的应用的名称

  3. What is your default Java package name?
    应用使用的默认包名,使用Yeoman的时候此值会被存储,当下次使用的时候此值会成为默认值,可覆写此值

  4. Do you want to use the JHipster Registry to configure, monitor and scale your application?
    JHipster Registry是一个开源的工具,用于管理你正在运行的应用(微服务注册中心和统一配置中心),只有在微服务架构时才会使用

  5. 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的配置

  1. 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(另一种分布式缓存),此选项可以提升你的应用的性能

  1. Do you want to use Hibernate 2nd level cache?
    此选项仅当你选择SQL数据库并且在Q9选择了一个缓存实现。Hibernate使用二级缓存可以更好的提升它的性能

  2. Would you like to use Maven or Gradle?
    构建此项目时将要使用的工具,Maven或者Gradle

  3. 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提供了简单的例子展示如和高效的使用

  1. Asynchronous messages using Apache Kafka
    是否使用Kafka来发布和订阅消息

  2. 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会自动配置

  1. Would you like to enable internationalization support?
    JHipster对于国际支持非常友好,你可以在客户端和服务端使用。但一般对于国际化要求不多的场景,可以不选择。

  2. 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商城安装第三方插件模块

猜你喜欢

转载自blog.csdn.net/ling_ling1997/article/details/82839026