SpringBoot 项目(若依脚手架)1

前言:

开发工具:IDEA

开发JDK版本:1.8

Maven版本:3.3+

①、maven的主配置settting.xml 文件中,需要配置 jdk 的版本,修改本地仓库默认位置、使用 阿里的远程仓库

②、在IDEA中配置 maven插件

目录

一、创建 SpringBoot项目,项目名为:ruoyi

二、引入依赖

三、登录页面

四、引入验证码

五、引入Shiro框架

六、在shiro中添加 验证码过滤器,完成首页验证码的显示

七、优化 ShiroConfig 权限配置类


一、创建 SpringBoot项目,项目名为:ruoyi

①、使用 Spring Initializr 初始化器创建一个 SpringBoot 项目,项目名为 ruoyi、选中 web模块

②、创建项目包结构:

com.ruoyi.common.constant
com.ruoyi.common.core
com.ruoyi.common.enums
com.ruoyi.common.exception
com.ruoyi.common.utils

com.ruoyi.framework.config
com.ruoyi.framework.shiro
com.ruoyi.framework.util
com.ruoyi.framework.web.service

com.ruoyi.system.domain
com.ruoyi.system.mapper
com.ruoyi.system.service
com.ruoyi.system.service.impl

com.ruoyi.web.controller.system

③、在resources 目录下创建如下文件夹

// 存放 mapper.xml 文件
resources/mapper/system

// 存放 mybatis 配置相关文件
resources/mybatis

// 存放静态资源文件
resources/static

// 存放 模块相关的 html 文件
resources/templates/system

二、引入依赖

本着用什么依赖,引入什么依赖的原则,先引入2个基本依赖

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

补充:引入 thymeleaf 依赖后,当 Controller 层返回的结果是字符串时,SpringBoot才会使用 themeleaf模板引擎解析字符串,返回相应的页面。例如 返回的是 “/system/user/user" 字符串, SpringBoot中对应的页面是:templates/system/user/user.html

三、登录页面

若依项目用到static 文件夹中静态资源,见百度网盘:https://pan.baidu.com/s/1sEe5FzYwEaFza0Mh1T-h4Q   提取码:yl2p

①、先从百度网盘中下载staitc.zip,将里面的内容拷贝到 static 文件夹中

②、编写 login.html 登录页面,即创建文件  templates / login.html, 内容如下:

<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    
    <title>登录若依系统</title>
    <meta name="description" content="若依后台管理框架">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
    <link href="../static/css/login.min.css" th:href="@{/css/login.min.css}" rel="stylesheet"/>
    <link href="../static/ruoyi/css/ry-ui.css" th:href="@{/ruoyi/css/ry-ui.css?v=4.0.0}" rel="stylesheet"
  • 4
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值