Spring Boot2 series of tutorials (a) | how to use the IDEA project to build Spring Boot

Micro-channel public number: a good wreck any questions or suggestions, please leave a message back, I will try to solve your problem.

Search
Search

Foreword

New legislation had a flag, a good operation of this public number. Specifically, it is a week to write two articles published in this number. The flag can not stand just so Kombat face. The following week brought the first chapter. In this article we will introduce embedded Intellij IDEA in Spring Initializr tool, as it provides the ability to create with Web, can help us to quickly build a foundation of Spring Boot project.

What is SpringBoot?

There is a saying SpringBoot official can be summed up this problem. That is "greater than the agreed configuration." What does this sentence mean? I believe learned Spring knows, we have to manually write a bunch of xml files for configuration, integration projects, in order to make this project with web functionality. And SpringBoot did those without it you will do Spring Bean configuration. It uses "convention than the configured" idea to get your project up and running quickly. Use Spring Boot very easy to create a separate run (run jar, embedded Servlet container), the level of production-based Spring framework of the project, you can not use Spring Boot requires little or Spring configuration.

If Spring is a car engine, it SpringMVC give the car on wheels, the equivalent emergence SpringBoot gives the car an autopilot function.

How to use IDEA to build SpringBoot project?

The first step, of course, is to install Intellij IDEA (fool-style tutorial, your own Baidu).

点击菜单栏 File ➤New➤Project ➤ 选择 Spring Initializr 创建界面如下图,可以看到图中 default 指定的 Initializr Service URL 就是 Spring 官方提供的 Spring Initializr 工具地址,一般默认即可,所以这里创建的工程实际上也是基于它的 Web 工具来实现的。

The initial interface
初始界面

点击 next 进入下一步,可以看见这里要我们选择的就是关于工程的一些信息:

  • Group 顾名思义就是你的公司名,一般是填写 com. 公司名。
  • Artifact groupId 和 artifactId 是 maven 管理项目包时用作区分的字段,就像是地图上的坐标。这里填写项目名即可。
  • Type 就是构建的项目类型,意思就是你希望你的项目使用什么工具构建,可选 maven 和 gradle 一般选 maven。
  • Language 顾名思义就是你的项目用啥语言开发,可选 Java、Groovy、Kotlin
  • Packaging 就是你希望你的项目打成什么形式的包,可选 Jar、War SpringBoot 项目一般选 Jar
  • Java Version 意指项目使用的 java 版本,根据你的需要选择。
  • Version 项目的初始版本,默认即可。
  • Name 项目名称。
  • Description 项目描述,默认即可。
  • Package 包名,填完 Group 和 Artifact 后自动生成,默认即可。 The next step

点击 Next 进入下一步,这一步就是选你的项目依赖包,前文所说的「约定大于配置」就体现在这里。进入选择 S pring Boot 版本和依赖管理的窗口。在这里值的我们关注的是,它不仅包含了 Spring Boot Starter POMs 中的各个依赖,还包含了 Spring Cloud 的各种依赖。

比如,你需要集成前端模板功能,你就到 Template Engines 选项卡上,勾选你想要访问的前端模板引擎,项目需要访问数据库,就到 SQL 选项卡,旋转你项目里使用的数据库类型。选择完成并加以简单的配置,项目就具备了集成前端模板能力与数据库访问能力。

这里注意一下,无论你选择哪些依赖包,其中 web 选项卡下的 Web 是必选的。这个包是整个项目的基础。这个包里面集成了 Spring 、WebMvc 、tomcat 以及其他各种基本能力。

The next step
下一步

点击 Next 进入下一步,这一步没啥好说的。就是让你确认自己的项目名以及项目路径。确认无误,点 Finish 完成创建即可。

Project Location
项目位置

Intellij IDEA 中的 Spring Initializr 是基于官方 Web 实现,但是通过工具来进行调用并直接将结果构建到我们的本地文件系统中,让整个构建流程变得更加顺畅。

后语

我为什么要写这种这么简单的教程? 是这样的,我始终认为比我聪明的人有很多,但比我笨的人也不少。在中国有很多你认为众所周知的事,其实有一车人根本不知道,这篇文章哪怕只帮助到一个人,足矣。

之后我打算出一个 SpringBoot 系列的教程,敬请关注与指正,本人也是一个小菜鸟在打怪升级中,如本文有不正确的地方,烦请指正。一起学习一起进步。

The above is the process of using IDEA create SpringBoot, I hope you find these helpful. If you see here, that you liked this article, please forward, thumbs up. Micro-channel search " a good basket case ", after concerns reply " 1024 " will give you a complete set of java tutorial.

Tutorial excerpt
Tutorial excerpt

Guess you like

Origin www.cnblogs.com/nasus/p/12101996.html