The microservice system starts, and the environment starts from 0 to build the process

1. Download and install JDK (for fools)

The installation process is fool-like, directly in place in one step. The version I installed is: jdk-17_windows-x64_bin

2. Download and install integrated development tools: IDEA (for fools)

ideaIU-2021.2.1
There are a lot of online resources, just find it yourself, you can download a plug-in, which can realize the automatic update of the software and will not expire.
(information can be found on me)

3. Apache Maven

3.1 Function

  1. It can help us build projects and manage jar packages in our projects
  2. Maven warehouse: the location where the build is stored
    1) Local warehouse: the default is ~/.m2/repository
  1. Remote warehouse: central warehouse (Maven), mirror warehouse (such as Alibaba Cloud's mirror warehouse, backup to the central) and private server warehouse (your own company's warehouse)

3.2 Installation

1) Software version: https://maven.apache.org/download.cgi
2) Change the central warehouse to a mirror warehouse, and the next download will be faster. (Find the setting.xml file in the conf folder of the compressed package, and modify the mirror in it as follows:

<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>central</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/central</url>
</mirror>

3) Configure environment variables: for easier use of maven

复制文件夹bin中文件mvn.cmd所在的目录存入path中

3.3 Create, compile, test (operate in cmd)

mvn -version  %查看Maven的版本,我的是3.6.1

3.4 Configure Maven in IDEA

1) The first two places need to be modified

2) Create a new project in IDEA and use the quick start version Maven history version
in Maven 3) My integrated development environment is IDEA2021, that is, it can support Maven versions before 3.8.1, and I downloaded 3.6.3
4) Precautions : When creating a new Maven project, pay attention to the selection of the jdk version , the selection of the Maven library and the correct selection of the configuration file . Pay attention to these three places.

4. Spring Initializr

1) Create a boot tool for the Springboot project (can download some commonly used packages in batches, avoiding downloading one by one)
2) Integrate the address of
the package Download the project after packaging, and then open the project.

5. Spring Boot (Benefit: out of the box)

1. Startup dependencies

2. Automatic configuration
Use the spring framework, Maven and other things need to configure the file, with springboot, you can save it, because there is a method that the agreement is greater than the configuration, and many things are initialized and configured.

3. Endpoint monitoring
Monitor the operation of the project.

6. MYSQL

1) Port number: When the database is started, the default port number occupied by this service is 3306. (The IP address corresponds to the computer, and the port number is the corresponding application)
2) Character set: In MySQL, the character set used is utf8
3) Account and password, the super administrator of mysql, the user name cannot be changed, it must be root , the password is set to: 123456.
The installation process can be done according to Lao Du’s. Running cmd can run automatically without additional configuration.
4) The database can be viewed through the software: NavicatforMySQL (very convenient to use)
The installation of MySQL can be directly referred to The video of Lao Du at station b. Basics of getting started with MySQL, mysql basics video + database combat, Lao Du will take you to learn

8. Installation and use of Git

8.1 Introduction

  1. Access address: https://git-scm.com/book/zh/v2
  2. Books to read: Chinese version available, core study chapters 1 and 2
  3. It is a distributed version control system, easy to use

8.2 Installation process

8.2.1 Software download

The download process is just the default

8.2.2 Test whether it is installed

Enter the following in the CMD command window to check the system configuration

git config --list
When the above situation occurs, it is installed

8.2.3 Configure Account and Email

Enter the following in the above window, check the system configuration again after the input is complete, and check whether the user name and email address appear at the end
Set the user name:

git config --global user.name "zhanghsan"

Set up email:

git config --global user.email [email protected]

8.3 Using Git to manage projects

1) Enter cmd in the project folder window to open the command window at the specified location

Find the folder, enter cmd in the content of the folder and press Enter), it will automatically jump to the cmd at the specified location, enter git init for Git management, and a hidden file (.git) will appear

After completing the above operations, the project has a .git file, indicating that the project has been managed by Git, and Git-related operations can be performed.

8.4 Git Common Commands

When executing the following commands, the location of the cmd operation needs to be the location of the project.

git init    %项目初始化,交给git进行管理
git status   %显示项目被git管理文件的状态信息(红色为未提交,绿色为被临时保存)
git add *  %临时存入仓库,相当于缓存,不上传,后面会丢失
git  commit -m 'test1'  %提交代码到本地仓库中去保存
The red above appears as an uncommitted state, that is, just after initialization

8.5 The operation of uploading Git projects to the cloud

For more convenient storage, our projects often need to be uploaded to the cloud for management, so the following shows an existing project, how to upload to the cloud, and after subsequent modifications, the modified code must also be submitted to the cloud. The project management tool used in this article is Gitee.

  1. Through ssl secure connection, generate a key (this machine is connected to the cloud code management tool to facilitate the subsequent upload of local projects)
ssh-keygen -t rsa -C "[email protected]"  %引号里的内容为自己的邮箱
  1. Go to the generated .ssh folder and find the file id_rsa.pub, copy the contents inside
  2. Go to the web interface in the remote warehouse to configure, and link the local git to the remote warehouse (I use the git code management platform)
  1. Upload the current project to the cloud code management platform
    First, you need to create a new project with the same name on Gitee and copy its link
    1) Use cmd locally to clone the gitee project.
    git clone The path of the warehouse% The path of the warehouse is the access to the project on gitee Path
    2) Put all the files in the local project into the clone project (just cloned)
    3) Statement trilogy: add to local warehouse temporary warehouse; submit to local warehouse; submit to remote warehouse
git status   #查看项目中文件的状态
git add .    #一个空格带个点,把所有的文件都放入暂存区
git commit -m '修改的名称'   #把暂存区项目放入本地仓库,并且添加本次项目修改的名字
git push   # 把这个项目上传到已经链接的线上远程仓库

4) In the following projects, open IDEA directly, and add will be executed automatically. You only need to actively implement commit and push operations.

The above figure shows that the association with Gitee is successful, and the local project is successfully uploaded.

8.6 How to download the projects on Gitee to the local

1) Find the Gitee project, select clone and download, and then HTTPS of the project

2) In the location where the project needs to be placed locally, open cmd and enter the following to clone

git clone https  %其中https为上面复制得到的https

8.7 Version Control System Development

Centralized version control system VCS

  1. Principle and Disadvantages:
    Principle: Everyone uploads their project to an online database and records various historical information of the project
    Disadvantage: If there is a problem with the online database, information will be lost

Distributed version control system Git

  1. Principle and Disadvantages:
    Principle: Everyone has a local warehouse and an online warehouse on their computer. There are two, which are more secure

8.8 IDEA integrates Git

1) In the IDEA settings, select Git in the version tool (select the path in the first line, that is, select the git.exe file in the computer)

2) Select the project and create a warehouse, which is initialization (that is, the function of git init, added to the local warehouse (uncommitted))

3) Submit the project to the local warehouse commit (ie git commit -m 'test1' % submit the code to the local warehouse to save)

4) Submit to the remote warehouse.
First, there must be a project with the same name in the remote warehouse, and then select pull. At this time, you need to define the url of the remote warehouse project to correspond.

Red coloured words

for copying

picture:

Guess you like

Origin blog.csdn.net/qq_42974034/article/details/129150520