Home >Java >javaTutorial >How IntelliJ IDEA runs the SpringBoot project

How IntelliJ IDEA runs the SpringBoot project

WBOY
WBOYforward
2023-05-20 17:07:131480browse

Java compilation tools and environment preparation:

IDEA JDK1.8 MySQL8.0 Maven

How IntelliJ IDEA runs the SpringBoot project

##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

Step 2: Configure maven steps

How IntelliJ IDEA runs the SpringBoot project

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

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

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

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

2. Find the place where jdk is configured and configure the jdk environment of your computer

How IntelliJ IDEA runs the SpringBoot project

3. Check some related directories and modify them to something related to jdk1.8

How IntelliJ IDEA runs the SpringBoot project

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

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

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 Configuration

spring:
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

Run the project

How IntelliJ IDEA runs the SpringBoot project

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete