springboot项目从环境配置到代码结构说明---随记

一、准备编辑器和maven环境

1. 安装IntelliJ IDEA作为编辑器  

安装地址:http://www.jetbrains.com/

插件安装说明:https://blog.csdn.net/qq_35246620/article/details/78289074?locationNum=6&fps=1

https://blog.csdn.net/qq_27093465/article/details/78338932?utm_source=gold_browser_extension

2. maven本地安装配置

3. IntelliJ IDEA 配置Maven

Tips:2,3参考 https://blog.csdn.net/xueyue616/article/details/82689687

另:需要maven依赖查询: http://mvnrepository.com/

例如:选择版本,复制红框内容至,代码的pom.xml文件中,邮件项目,maven download或者update

二、数据库准备

1. 安装数据库环境 选择一种数据库类型(postgresql、MySQL等等)

2. 安装数据库管理工具(pgAdmin、Navicat Premium等)

3. 建立连接

1)Navicat界面:连接名、库名等填写好 ->点击“测试连接”

2)pgAdmin界面:

4. 建库建表

1)建库

2)建表

3)插记录

三、建springboot工程

https://www.jianshu.com/p/f808b5cf9e83
四、开发

代码结构:


4.1 在model(类似于entity)新建Do类class
4.2 在dao中建操作数据库的接口(dao就是数据库操作的接口)
    用jpa的话基本的操作都有了,复杂业务查询自己写(i18n)
    用mybatis的话就要写mapper(xml文件)
4.3 在service里面定义业务逻辑的接口,实现是在service.impl里面写
4.4 在controller里面写调用restful服务

Spring Boot 使用Swagger2构建RESTful API :http://www.spring4all.com/article/251

发布了18 篇原创文章 · 获赞 9 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/xueyue616/article/details/82698134