美文网首页
搭建springboot web

搭建springboot web

作者: 让随着风飘 | 来源:发表于2018-08-28 16:31 被阅读29次

                                                搭建springboot web

一、简介:

springboot在提供rest服务的同时,也可以通过注解配置支持web功能,可以很方便地实现前后端分离。

二、依赖:

//org.springframework.data:spring-data-jpa:2.0.4.RELEASE

org.springframework.boot:spring-boot-starter:2.0.4.RELEASE

org.springframework.boot:spring-boot-starter-data-jpa:2.0.4.RELEASE

org.springframework.boot:spring-boot-configuration-processor:2.0.4.RELEASE

org.springframework.boot:spring-boot-starter-web:2.0.4.RELEASE

org.springframework.boot:spring-boot-starter-thymeleaf:2.0.4.RELEASE

mysql:mysql-connector-java:5.1.46

com.alibaba:fastjson:1.2.47

jpa:代替mybatis,作为ORM层,封装查询业务逻辑。

configuration-processor:自动解析application.yml中的配置

web:提供web功能,包括rest服务均需要使用该包

thymeleaf:静态资源方面,前端内容配置相关

fastjson:rest服务返回数据使用,比list,map方便点

三、搭建项目

工程结构

idea->maven->quick start->等等。没有resources目录及下面所有文件均需要手动创建。

名字resources固定,

static名字固定(默认为static,jar包中有默认配置文件,暂时没去找),存放静态资源,图片,js,css等

templates名字固定,下面存放html静态页面模板

application.yml是唯一配置文件,图片中的genneratorConfig.xml,mybatis-config.xml无需理会。

结构有控制层,业务层,数据持久层,

控制层:

按功能分为rest服务controller,页面跳转controller

github:https://github.com/guyingi/demo-dashboard

相关文章

网友评论

      本文标题:搭建springboot web

      本文链接:https://www.haomeiwen.com/subject/ujfqwftx.html