Java compilation tools and environment preparation:
IDEA JDK1.8 MySQL8.0 Maven
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363639548.png)
##Step 1: Configure maven
Step one: Open the project with IDEA and start configuring the maven environment. If maven is not configured locally in advance, just use IDEA's default configuration
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363671993.png)
Step 2: Configure maven steps
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363750445.png)
Case 1: If maven has not been configured locally, you can keep the following default configuration (case 2 is ignored if not configured)
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363717774.png)
Case 2: If the maven warehouse address has been configured locally, you need to change the red box above to your local maven address
If I have configured the maven warehouse
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363767493.png)
The maven warehouse has been configured locally: the following three configuration reference cases
One is the directory, one is the xml file, and the other is the jar package address
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363798849.png)
There is a maven environment locally, so the configuration modification and local adaptation here
Step 2: Configure the JDK environment
1. If the code becomes popular, remember Check whether the Java running environment is configured
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363842196.png)
2. Find the place where jdk is configured and configure the jdk environment of your computer
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363839784.png)
3. Check some related directories and modify them to something related to jdk1.8
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363878884.png)
4. Remember to click Apply for the above configuration and then click OK
to complete the execution Click the refresh button on the right side of the picture below multiple times
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363819696.png)
If it becomes popular, click the refresh symbol multiple times, and you can also perform pre-compilation. After execution, the dependencies will be downloaded to the local normally
Reason for popularity: The local dependency package is missing and needs to be downloaded. Click the refresh symbol to download it
Step 3: Check the configuration of the database
[Configuration file] SpringBoot project finds applicationyml File
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363898508.png)
Check whether the database name, database account, and database password are consistent with the local MySQL and MySQL library
Required when using druid connection pool Configurationspring:
datasource:
username: root
password: root
url: jdbc:mysql://127.0.0.1:3307/property_db_copyautoReconnect=true&useUnicode=true&characterEncoding=utf8
driver-class-name: com.mysql.jdbc.Driver
Note: Change SpringBoot’s default DataSource to DruidDataSource
type: com.alibaba.druid.pool.DruidDataSource
Steps Four: Database connection
Use the database connection tool to connect to MySQL (I use Navicat)
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363852386.png)
Run the project
![How IntelliJ IDEA runs the SpringBoot project](https://img.php.cn/upload/article/000/887/227/168457363926136.png)
You're done, enter http://localhost:2281/ to access the page
Please see the database initialization data for the login account and password
The above is the detailed content of How IntelliJ IDEA runs the SpringBoot project. For more information, please follow other related articles on the PHP Chinese website!