当前位置:网站首页>1. project environment construction
1. project environment construction
2022-06-24 10:15:00 【xjhqre】
Development environment construction
1、 Database environment construction
1、 Create database

Or use the command line to create :
create database reggie character set utf8mb4
2、 Import SQL file db_reggie.sql, You can get it on Heima wechat
Command line import :source D:\db_reggie.sql
3、 Database table description
| Serial number | Table name | explain |
|---|---|---|
| 1 | employee | The employee table |
| 2 | category | Classification of dishes and packages |
| 3 | dish | Menu |
| 4 | setmeal | Package list |
| 5 | setmeal_dish | Relationship table of package dishes |
| 6 | dish_flavor | Table of dish taste relationship |
| 7 | user | User table (C End ) |
| 8 | address_book | Address book table |
| 9 | shopping_cart | Shopping cart table |
| 10 | orders | The order sheet |
| 11 | order_detail | Order details |
2、maven Project structures,
1、 establish maven engineering , Of course, it can also be created directly SpringBoot engineering

2、 Import maven To configure
- add to spring-boot-starter-parent
- Appoint java edition
- Import dependence
- add to spring-boot-maven-plugin plug-in unit
complete pom.xml file :
<?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 http://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.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.itheima</groupId>
<artifactId>reggie_take_out</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.76</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.23</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.5</version>
</plugin>
</plugins>
</build>
</project>
3、 To configure application.yml
- stay resources Create under directory application.yml
- configure port
- Configuration item name
- Configure database connections
complete application.yml:
server:
port: 8080
spring:
application:
name: reggie_take_out
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/reggie?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
mybatis-plus:
configuration:
# When mapping entities or attributes , Remove the underscores from the table names and field names in the database , Map according to the hump nomenclature
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
id-type: ASSIGN_ID
4、 start-up SpringBoot
Create startup class ReggieApplication, Click on the run
package com.itheima.reggie;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/** * @Author: xjhqre * @DateTime: 2022/6/15 16:20 */
@Slf4j
@SpringBootApplication
public class ReggieApplication {
public static void main(String[] args) {
SpringApplication.run(ReggieApplication.class, args);
log.info(" The project started successfully ...");
}
}
3、 Import the front page
1、 Put the backend and front Copy directory to resources Under the table of contents
2、 Create configuration class WebMvcConfig Configure front-end resource request mapping
package com.itheima.reggie.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
/** * @Author: xjhqre * @DateTime: 2022/6/15 16:24 */
@Slf4j
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
/** * Set static resource mapping * @param registry */
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
super.addResourceHandlers(registry);
log.info(" Start static resource mapping ...");
registry.addResourceHandler("/backend/**").addResourceLocations("classPath:/backend/");
registry.addResourceHandler("/front/**").addResourceLocations("classPath:/front/");
}
}
3、 Restart the service , visit http://localhost:8080/backend/index.html See the effect
边栏推荐
猜你喜欢

Phpstrom code formatting settings

uniapp实现点击拨打电话功能

Jcim | AI based protein structure prediction in drug discovery: impacts and challenges

uniapp开发微信小程序,显示地图功能,且点击后打开高德或腾讯地图。

Machine learning - principal component analysis (PCA)

canvas管道动画js特效

队列Queue

Cookie encryption 4 RPC method determines cookie encryption

机器学习——感知机及K近邻

p5.js实现的炫酷交互式动画js特效
随机推荐
2022-06-23:给定一个非负数组,任意选择数字,使累加和最大且为7的倍数,返回最大累加和。 n比较大,10的5次方。 来自美团。3.26笔试。
Go language development environment setup +goland configuration under the latest Windows
小程序 rich-text中图片点击放大与自适应大小问题
学习使用php对字符串中的特殊符号进行过滤的方法
411-栈和队列(20. 有效的括号、1047. 删除字符串中的所有相邻重复项、150. 逆波兰表达式求值、239. 滑动窗口最大值、347. 前 K 个高频元素)
自定义kindeditor编辑器的工具栏,items即去除不必要的工具栏或者保留部分工具栏
Can the long-term financial products you buy be shortened?
Array seamless scrolling demo
JS singleton mode
形状变化loader加载jsjs特效代码
SVG+js拖拽滑块圆形进度条
Which of the top ten securities companies has the lowest Commission and is the safest and most reliable? Do you know anything
小程序学习之获取用户信息(getUserProfile and getUserInfo)
JS proxy mode
[db2] sql0805n solution and thinking
leetCode-1089: 复写零
Status of the thread pool
413-二叉树基础
Safety and food security for teachers and students of the trapped Yingxi middle school
Operator details