SpringBoot框架搭建详细教程【附源码及下载地址】⽬录
【开发环境】
1.操作系统:windows
2.开发⼯具:IDEA
3.java -version
⼀、【新建项⽬】
File→New Project→Spring Initializr,选择下⼀步
添加组织信息,然后下⼀步
选择SQL→Mybatis Framework,然后下⼀步
点击finish
项⽬创建完毕,⽬录结构如下,可以对⽬录结构做个优化,删除标红部分。
⼆、【⽬录结构调整】
修改src-main-java下的⽂件名为cn.springboot
项⽬完整⽬录结构:
- Java为主Java代码⽂件夹
  - Controller 控制器⽂件⽂件夹
  - Dao (数据访问)层⽂件夹
  - Service(业务逻辑)层⽂件夹
  - Entity(实体)层⽂件
- resources资源⽂件夹
  - mapper mybatis⽂件夹
- sql 数据表⽂件夹
- Test 测试⽂件夹
三、【maven包初始化】
Maven是采⽤配置⽂件的⽅式进⾏jar包的⾃动导⼊。下⾯添加我们将会⽤到的⼀系列jar包配置:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="/POM/4.0.0" xmlns:xsi="/2001/XMLSchema-instance"        xsi:schemaLocation="/POM/4.0.0 /xsd/maven-4.0.0.
xsd">    <modelVersion>4.0.0</modelVersion>
<groupId>cn.springboot</groupId>
<artifactId>springboot_test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>springboot_test</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
&porting.outputEncoding>UTF-8</porting.outputEncoding>        <java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId&batis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>com.</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>cn.springboot.SpringbootTestApplication</mainClass>                </configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
mysql下载jar包</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。