Idea+SpringBoot+MySQL+mybatis quickly build a project

Look at the picture, Ori gives

Insert picture description here
Insert picture description here

Insert picture description here
Insert picture description here
Set the address where your project is stored, it’s best to choose the address yourself, otherwise you don’t know where the project is in two days.
Insert picture description here
Insert picture description here
Connect to the database
Insert picture description here
Insert picture description here

这是我的源码,请参考

spring.datasource.url=jdbc:mysql:///localhost:3306/ssm001?useUnicode=true&characterEncoding=utf-8
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
mybatis.mapper-locations=classpath:mapper/*.xml

If it is created for the first time, it may take a long time to download dependencies. Just wait. Until there is no progress bar loading at the bottom of the window. Possible problems are listed below.

1. The icons of the java and resources folder are incorrect
Insert picture description here
Insert picture description here
Insert picture description here
. 2. The file dependency error is reported. You can try the following operations. (Please ensure that the progress bar at the bottom of the window is completed before proceeding)

2.1 Attention to this operation, step by step, wait for 2 to load and then execute 3
Insert picture description here

2.2 If 2.1 cannot be resolved, check whether your pom.xml file is red. If it is red, there may be things that have not been downloaded. If it still doesn't work, compare my pom.xml to see if something is generated wrong.

pom.xml文件内容如下


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo4</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo4</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.3</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Guess you like

Origin blog.csdn.net/MYNAMEL/article/details/109463815