二、Jhipster实战演练-从简单应用开始

一、创建一个小应用

从一个简单应用开始,先通过Jhipster创建一个简单的web应用。

1、用管理员角色打开cmd命令行,进入到自己需要创建应用的路径(注意:需要在新建的文件夹里面);


2、输入【jhipster】命令,开始创建web应用;


3、通过向导式的问题一步步完成web应用的创建(下面用红色标出选择);

    Which type of application would you like to create?(你想创建哪种类型的应用?)

  • Monolithic application: this a classical, one-size-fits-all application. It’s easier to use and develop, and is our recommended default.(单体应用,适合大多数人,系统默认)
  • Microservice application: in a microservices architecture, this is one of the services.(微服务应用)
  • Microservice gateway: in a microservices architecture, this is an edge server that routes and secures requests.(微服务网关,包括注册中心、配置中心都是该选项)
  • JHipster UAA server: in a microservices architecture, this is an OAuth2 authentication server that secures microservices. Refer to the JHipster UAA documentation for more information(JHipster自带的认证中心服务)


4、由于我们是创建简单的web应用,选择【Monolithic application】,然后继续;

    What is the base name of your application?(应用程序的基本名称是什么?)


5、也就是项目名称,系统默认为文件夹名称,此处不做更改,直接回车继续;

    What is your default Java package name?(默认的java包名称应用程序的基本名称是什么?)


6、默认的java包名称,默认为【com.jhipster】,此处不做更改,直接回车继续;

    Do you want to use the JHipster Registry to configure, monitor and scale your application?(是否需要使用注册配置中心来扩展应用)


7、本次创建简单web应用,选择【N】回车继续;

    Which type of authentication would you like to use?(你想选择哪种认证方式)

  • JWT authentication: use a JSON Web Token (JWT), which is the default choice(使用JWT认证)
  • 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).(基于HTTP Session认证)
  • OAuth 2.0 / OIDC Authentication: this uses an OpenID Connect server, like Keycloak or Okta, which handles authentication outside of the application.(使用OAuth2.0)


8、根据实际情况选用即可,本次选用JWT回车继续;

    Which type of database would you like to use?(选用数据库类型)


9、选择【SQL】回车继续;

    Which production database would you like to use?(你想用哪种数据库产品)


10、选择【MYSQL】回车继续;

    Which development database would you like to use?(你想用哪种开发数据?)


11、选择【MYSQL】回车继续;

    Do you want to use the Spring cache abstraction?(你想用spring的抽象缓存吗?)


12、本次选择【NO】回车继续;

    Would you like to use Maven or Gradle?(构建工具选择)


13、根据实际情况,默认使用Maven进行构建;

    Which other technologies would you like to use?(其他技术选择)


14、本次不选择其他技术,直接回车继续;

    Which Framework would you like to use for the client?(前端框架选择)


15、根据实际情况选择,本次选择【Angular 6】回车继续;

    Would you like to use the LibSass stylesheet preprocessor for your CSS?(你想为你的CSS使用LibSass样式表预处理器吗?


16、默认为【N】回车继续;

    Would you like to enable internationalization support?(你想开启国际化支持吗?)


17、默认为【Y】,输入【N】回车继续;

    Which testing frameworks would you like to use?(测试框架选择)


18、本次不选用,回车继续;

    Would you like to install other generators from the JHipster Marketplace?(是否启用JHipster 市场)


19、默认为【N】,回车继续;

20、回答完以上问题,Jhipster开始自动生成构建项目;

21、简单项目创建完成;


二、Eclipse设置

1、将创建的项目导入到eclipse;


2、在项目上右键,Project -> Properties -> Resource -> Resource Filters,选择【Exclude all】, 在【Applies to 】选中【folders】, Name matches 输入【node_modules】,点击OK;


3、点击菜单【Help】,选中【Eclipse Marketplace】,输入【jhipster】,点击【install】安装jhipster插件;



三、启动应用

1、修改【/simple-app/src/main/resources/config/application-dev.yml】配置文件,将【spring.datasource】改为正确的数据库配置(默认激活dev配置);


2、在Eclipse找到类【/simple-app/src/main/java/com/jhipster/SimpleApp.java】,右键【run->java application】;


3、使用管理员打开cmd命令行,进入到工程路径然后输入:【yarn start】,启动前端应用;


4、打开浏览器,输入【http://localhost:9000】,通过:admin/admin账号登陆。由于没有生成任何对象实体,所以只有相关的监控信息;

5、工程启动成功;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值