2021-06-29

Jhipster的学习:

前言:

    自己工作也将近一年的时间,在此过程中遇到了不少问题,尤其是在构建项目过程中需要花费较多的时间,因此想着有没有第三方工具能够快速的构建项目,从而找到了Jhipster发现挺好用的为此记录一下。

Jhipster介绍:

    Jhipster在他的官网上有一句描述的话,JHipster是一个开发平台,可以快速生成,开发和部署现代Web应用程序+微服务架构。他能够自动生成后端项目结构包含了springboot、spring security和spring data jpa等功能,以及前端react和angular也能够生成。

Jhipster安装:

    首先安装Jhipster之前请确保安装了node.js,之后执行
npm install -g generator-Jhipster

    如果不想生成前端代码可以使用跳过前端代码的构建

npm install -g generator-Jhipster --skip-client

    安装好在指定目录创建文件夹jhTest,然后在该目录下执行jhipster回车,会出现一系列的项目构建选项进行选择

1. What is the base name of your application? (您的应用程序的基础名是什么?)
 这是您应用程序的名称。
2. What is your default Java package name? (您的默认Java软件包名称是什么?)
 您的Java应用程序将以此为包的根名称。 
3. Do you want to use the JHipster Registry to configure, monitor and scale your application? 
JHipster Registry是一个开源工具,用于管理您在运行中的应用程序。可不选。
4.Which type of authentication would you like to use?
选择认证方式,如JWT,OAuth 2.0,HTTP会话等。
5.Which type of database would you like to use?
选择数据库类型,提供了sql的,nosql的,供你选择。
6.Which production database would you like to use?
您要使用哪个 生产 数据库
7. Which development database would you like to use? 
您要使用哪个 开发 数据库?一般选h2-disk
8.Do you want to use the Spring cache abstraction?
您是否要使用Spring抽象缓存?
9. Would you like to use Maven or Gradle?
您要使用Maven还是Gradle?
10. Which other technologies would you like to use?
您还想使用哪些其他技术?根据需要选择即可
11. Which Framework would you like to use for the client? 
您想为前端选择使用哪个框架 ?给出的选项是angular,react,vue
12.Would you like to use a Bootswatch theme? 
选择你想要使用的前端题。
13.Would you like to use the Sass stylesheet preprocessor for your CSS?
您想为CSS使用Sass样式表预处理器吗?
14.Which testing frameworks would you like to use? 
您想使用哪些测试框架?可选的是Gatling,Cucumber等。
15.Would you like to install other generators from the JHipster Marketplace?
您是否要从JHipster市场安装其他生成器? 选否就行。

Jhipster制定实体类:

    Jhipster推荐使用JDL进行实体类,根据官网给出的博客为例子
entity Blog {
  name String required minlength(3),
  handle String required minlength(2)
}

entity Entry {
  title String required,
  content TextBlob required,
  date Instant required
}

entity Tag {
  name String required minlength(2)
}

relationship ManyToOne {
  Blog{user(login)} to User,
  Entry{blog(name)} to Blog
}

relationship ManyToMany {
  Entry{tag(name)} to Tag{entry}
}

paginate Entry, Tag with infinite-scroll

    写好后保存为test.jh,在之前制定的文件目录内执行

jhipster jdl blog.jh --ignore-application

    --ignore-application用于防止jdl生成实体类的时候,重新构建整个项目
在这里插入图片描述
至此一个简单的SpringBoot项目就构建完毕了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值