SpringBoot项目-个人博客系统的实现

1.博客系统简要分析

在这里插入图片描述
一共有6个网页,分别是博客列表页面,博客详情页面,发布博客页面,博客登陆页面,博客更新页面,修改个人信息页面(暂未实现),我们要实现的功能有,实现博客列表的展示页面,博客详情页面的展示功能,用户登录功能,显示用户信息功能,编辑博客功能,发布博客功能,删除博客功能,退出登录功能
我们现在就开始写吧

2.创建springBoot项目

1.创建项目,勾选需要的依赖

在这里插入图片描述
在这里插入图片描述

2.删除无用的目录及文件

在这里插入图片描述

4.创建框架

在这里插入图片描述

3.配置文件(选择yml)

application.xml

spring:
  profiles:
    active: dev
logging:
  file:
    path: logs/
  level:
    root: info

application-dev.xml

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/java_blog_spring?characterEncoding=utf8
    username: root
    password: 111111
    driver-class-name: com.mysql.cj.jdbc.Driver
mybatis:
  configuration: # 配置打印 MyBatis 执行的 SQL
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    map-underscore-to-camel-case: true  #自动驼峰转换
  mapper-locations: classpath:mapper/***Mapper.xml

application-prod.xml

spring:
  datasource:
      url: jdbc:mysql://127.0.0.1:3306/java_blog_spring?characterEncoding=utf8
      username: root
      password: 111111
      driver-class-name: com.mysql.cj.jdbc.Driver
mybatis: #上线就不用打印mybatis执行日志
  configuration:
    map-underscore-to-camel-case: true  #自动驼峰转换

3.数据库准备

这个项目的数据库表比较简单
只有两个表

1.设计表结构

在这里插入图片描述

2.建表sql

-- 建表SQL
create database if not exists `java_blog_spring1` charset utf8mb4;
-- 用户表
drop table if exists `java_blog_spring`.`user`;
CREATE TABLE `java_blog_spring`.`user` (
 `id` INT NOT NULL AUTO_INCREMENT,
 `user_name` VARCHAR(128) NOT NULL,
 `password` VARCHAR(128) NOT NULL,
 `photo`  VARCHAR(128) NOT NULL,
 `github_url` VARCHAR(128) NULL,
 `delete_flag` TINYINT(4) NULL DEFAULT 0,
 `create_time` TIMESTAMP NULL DEFAULT current_timestamp(),
 PRIMARY KEY (`id`),
 UNIQUE INDEX `user_name_UNIQUE` (`user_name` ASC))
ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COMMENT = '用户表';
-- 博客表
drop table if exists `java_blog_spring`.`blog`;
CREATE TABLE `java_blog_spring`.`blog` (
 `id` INT NOT NULL AUTO_INCREMENT,
 `title` VARCHAR(200) NULL,
 `content` TEXT NULL,
 `user_id` INT(11) NULL,
 `delete_flag` TINYINT(4) NULL DEFAULT 0,
 `create_time` TIMESTAMP NULL DEFAULT current_timestamp(),
 PRIMARY KEY (`id`))
ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '博客表';
-- 新增用户信息
insert into `java_blog_spring`.`user` (`user_name`, `password`,`photo`,`github_url`)values
("zhangsan","123456","pic/doge.jpg","https://gitee.com/bubble-fish666/class-java45");
insert into `java_blog_spring`.`user` (`user_name`, `password`,`photo`,`github_url`)values
("lisi","123456","pic/doge.jpg","https://gitee.com/bubble-fish666/class-java45");
insert into `java_blog_spring`.`blog` (`title`,`content`,`user_id`) values
("第一篇博客","111我是博客正文我是博客正文我是博客正文",1);
insert into `java_blog_spring`.`blog` (`title`,`content`,`user_id`) values
("第一篇博客","222我是博客正文我是博客正⽂我是博客正文",2);

use java_blog_spring;
-- 查询两个表的数据
select * from user;
select * from blog;

4.接口设计

  1. 获取所有的博客列表

5.数据库相关查询操作

  1. 根据用户id查询用户信息
  2. 根据用户名称查询用户
  3. 查询所有未删除的博客(按照时间降序排列)
  4. 根据博客id查询博客详情
  5. 插入一条博客
  6. 根据博客id更新博客
  7. 删除博客
  8. 根据用户id查询博客数量

6.写代码准备工作

1.model包下,创建Java实体类

我们在配置文件中配置了数据库表字段到类属性的自动驼峰转换,所以可以不用进行重命名

自动驼峰映射

configuration:
 map-underscore-to-camel-case: true

1.User类

@Data
public class User {
    // java中属性使用小驼峰命名
    // 我们配置了自动驼峰转换
    private Integer id;
    private String userName;
    private String passWord;
    private String photo;
    private String githubUrl;
    private Byte deleteFlag;
    private Date createTime;
}

2.Blog类

@Data
@Data
public class Blog {
    private Integer id;
    private String title;
    private String content;
    private Integer userId;
    private Integer deleteFlag;
    private Date createTime;
}

2.mapper层

  • 简单的sql语句我们使用注解实现
  • 复杂的sql语句使用xml配置文件实现

1.userMapper接口

@Mapper
public interface UserMapper {
    /**
     * 根据用户id查询用户信息
     * @param id
     * @return
     */
    @Select("select user_name, password, photo, github_url from user where delete_flag = 0 and id = #{id}")
    User selectById(Integer id);

    /**
     * 根据用户名称查询用户
     * @param userName
     * @return
     */
    @Select(("select user_name, password, photo, github_url from user where delete_flag = 0 and user_name = #{userName}"))
    User selectByName(String userName);

}

2.BlogMapper接口

@Mapper
public interface BlogMapper {

    /**
     * 查询所有未删除的博客.按照时间降序排列
     * @return
     */
    @Select("select id, title, content, user_id, create_time from blog where delete_flag = 0 order by create_time;")
    List<Blog> selectAllBlog();

    /**
     * 根据博客id查询博客详情
     * @param blogId
     * @return
     */
    @Select("select id, title, content, user_id, create_time from blog where delete_flag = 0 and id = #{blogId}")
    Blog selectByBlogId(Integer blogId);

    /**
     * 插入一条博客
     * @param blog
     * @return
     */
    @Insert("insert into blog (title, content, user_id) values (#{title, #{content}, #{userId})")
    Integer insertBlog(Blog blog);

    /**
     * 根据博客id更新博客
     * 删除博客就是把delete_id改为1
     * @return
     */
    Integer updateBlog(Blog blog);

    /**
     * 根据用户id查询博客数量
     * @param userId
     * @return
     */
    @Select("select count(id) from blog where delete_flag = 0 and user_id = #{userId}")
    Integer selectBlogCount(Integer userId);

}

因为更新博客内容的sql语句比较复杂,我们就不采用注解的方式,使用配置文件的方式来写

3.BlogMapper.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.springblog.mapper.BlogMapper">

    <update id="updateBlog">
        update blog
        <set>
            <if test="title!=null">title=#{title},</if>
            <if test="content!=null">content=#{content},</if>
            <if test="deleteFlag!=null">delete_flag=#{deleteFlag},</if>
        </set>
        <where>
            id = #{id}
        </where>
    </update>
</mapper>

3.Service包下

service层被称作业务层,它用来处理逻辑上的业务,而不去考虑具体的实现,这样controller层就不会直接去调用mapper层,可以将代码解耦,便于扩展

1.UserService类

@Service
public class UserService {
    @Autowired
    // 将UserMapper对象注入进来
    private UserMapper userMapper;

    /**
     * 根据用户id查询用户信息
     * @param id
     * @return
     */
    public User selectById(Integer id) {
        return userMapper.selectById(id);
    }

    /**
     * 根据用户名称查询用户
     * @param userName
     * @return
     */
    public User selectByName(String userName) {
        return userMapper.selectByName(userName);
    }

}

2.BlogService类

@Service
public class BlogService {

    @Autowired
    private BlogMapper blogMapper;
    /**
     * 查询所有未删除的博客.按照时间降序排列
     * @return
     */
    public List<Blog> selectAllBlog() {
        return blogMapper.selectAllBlog();
    }

    /**
     * 根据博客id查询博客详情
     * @param blogId
     * @return
     */
    public Blog selectByBlogId(Integer blogId) {
        return blogMapper.selectByBlogId(blogId);
    }

    /**
     * 插入一条博客
     * @param blog
     * @return
     */
    public Integer insertBlog(Blog blog) {
        return blogMapper.insertBlog(blog);
    }

    /**
     * 根据博客id更新博客
     * 删除博客就是把delete_id改为1
     * @return
     */
    public Integer updateBlog(Blog blog) {
        return blogMapper.updateBlog(blog);
    }

    /**
     * 根据用户id查询博客数量
     * @param userId
     * @return
     */
    public Integer selectBlogCount(Integer userId) {
        return blogMapper.selectBlogCount(userId);
    }
}


4.测试

使用BlogMapper做演示,UserMapper同理

在mapper接口点击Fn+Alt+Insert(按钮因电脑而异,不行可以试下Alt+Insert)
然后在弹出框中点击Test

在这里插入图片描述
然后勾选需要测试的方法
在这里插入图片描述
此时就可以看到test包下出现了对应的类
在这里插入图片描述
然后我们就可以在这里写测试方法

1.BlogMapperTest测试类

@SpringBootTest
class BlogMapperTest {

    @Autowired
    private BlogService blogService;

    @Test
    void selectAllBlog() {
        List<Blog> blogs = blogService.selectAllBlog();
        System.out.println(blogs.toString());
    }

    @Test
    void selectByBlogId() {
        System.out.println(blogService.selectByBlogId(2).toString());
    }

    @Test
    void insertBlog() {
        Blog blog = new Blog();
        blog.setTitle("测试");
        blog.setContent("测试正文");
        blog.setUserId(1);
        System.out.println(blogService.insertBlog(blog));
    }

    @Test
    void updateBlog() {
        Blog blog = new Blog();
        blog.setTitle("测试更新");
        blog.setId(1);
        System.out.println(blogService.updateBlog(blog));
    }

    @Test
    void deleteBlog() {
        Blog blog = new Blog();
        blog.setDeleteFlag(1);
        blog.setId(1);
        System.out.println(blogService.updateBlog(blog));
    }

    @Test
    void selectBlogCount() {
        System.out.println(blogService.selectBlogCount(2));
    }
}

2.UserMapperTest测试类

@SpringBootTest
class UserMapperTest {

    @Autowired
    private UserService userService;

    @Test
    void selectById() {
        System.out.println(userService.selectById(1).toString());
    }

    @Test
    void selectByName() {
        System.out.println(userService.selectByName("zhangsan").toString());
    }
}

3.测试结果

在这里插入图片描述

在这里插入图片描述

5.添加前端界面

把之前写好的博客系统静态页面拷贝到static⽬录下
在这里插入图片描述

6.添加公共模块

⼯具层(common) => 统⼀返回类, 统⼀异常处理类

1.添加统一返回类Result

@Data
public class Result {

    private Integer code;
    private String msg;
    private Object data;


    /**
     * 业务执行成功返回的数据
     * @return
     */
    public static Result success(String msg, Object data) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    /**
     * 业务执行成功返回的数据
     * @return
     */
    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("执行成功");
        result.setData(data);
        return result;
    }

    /**
     * 业务执行失败返回的数据
     * @return
     */
    public static Result fail(Integer code, String msg, Object data) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    /**
     * 业务执行失败返回的数据
     * @return
     */
    public static Result fail(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}


2.添加统一异常处理类

使用code = -1表示出现异常

@ControllerAdvice
@ResponseBody
public class ErrorAdvice {

    @ExceptionHandler
    public Result error (Exception e) {
        return Result.fail(-1, e.getMessage());
    }

}

3.添加统一返回格式

在数据返回之前调用此方法,将返回数据格式统一
如果是String类型会报错,所以我们要处理一下,异常使用@SneakyThrows注解
如果返回的数据格式,已经是Result类型,就不需要处理,直接返回即可

@ControllerAdvice
public class ResponseAdvice implements ResponseBodyAdvice {

    /**
     * 内容是否需要重写
     * 返回true表示需要重写
     * @param returnType
     * @param converterType
     * @return
     */
    @Override
    public boolean supports(MethodParameter returnType, Class converterType) {
        return true;
    }

    /**
     * 方法返回之前调用此方法
     */
    //
    @SneakyThrows
    @Override
    public Object beforeBodyWrite(Object body, // 相应的正文内容
                                  MethodParameter returnType,
                                  MediaType selectedContentType,
                                  Class selectedConverterType,
                                  ServerHttpRequest request,
                                  ServerHttpResponse response) {
        //如果返回的数据格式,已经是Result类型,就不需要处理,直接返回即可
        if (body instanceof Result) {
            return body;
        }
        // 如果是String类型会报错,所以我们要处理一下
        if (body instanceof String) {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.writeValueAsString(body);
        }
        return Result.success(body);
    }
}

7.实现博客列表显示

1.约定前后端交互的接口

【请求】

  • blog/getList

【响应】

  1. [200]
  • [200]返回数据成功,显示博客列表
  • [-1]目前没有博客
  1. [401]没有权限访问
  2. [error]访问出现错误,打印异常信息

浏览器给服务器发送一个blog/getList这样的Http请求,服务器返回给浏览器一个json格式的数据

2.实现服务器代码

@RestController
@RequestMapping("/blog")
public class BlogController {

    @Autowired
    private BlogService blogService;

    @RequestMapping("/getList")
    public List<Blog> getList() {
        // 获取博客列表
        List<Blog> blogs = blogService.selectAllBlog();
        if (blogs == null) {
            return null;
        }
        return blogs;
    }
}

使用postman测试成功,服务器正确返回数据
在这里插入图片描述

3.实现客户端代码

修改 blog_list.html, 删除之前写死的博客内容(即 <div class=“blog”> ), 并新增js 代码处理 ajax 请求.

  1. 使用ajax给服务器发送数据
  2. 服务器返回一个json数据格式的响应
  3. 前端根据这个响应使用DOM API构造页面内容
  4. 响应中的时间为时间戳,需要修改
  5. 列表中拿到的content应该是已经裁剪过的摘要
  6. 跳转到博客详情页的url应该在后面加上参数blogId=1,这样可以让博客详情页知道当前访问的是哪篇博客
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <script>
        $.ajax({
            type: "get",
            url: "/blog/getList",
            success: function (result) {
                if (result.code == 200 && result.data != null && result.data.length > 0) {
                    //循环拼接数据到document
                    var finalHtml = "";
                    for (var blog of result.data) {
                        finalHtml += '<div class="blog">';
                        finalHtml += '<div class="title">' + blog.title + '</div>';
                        finalHtml += '<div class="date">' + blog.createTime + '</div>';
                        finalHtml += '<div class="desc">' + blog.content + '</div>'
                        finalHtml += '<a class="detail" href="blog_detail.html?blogId = '+blog.id+'">查看全⽂&gt;&gt;</a>'
                        finalHtml += '</div>';
                    }
                    $(".right").html(finalHtml);
                } else if (result.code == -1) {
                    alert(result.mag);
                }
            },
            error: function () {
                console.log("后端返回失败");
            }
        });
    </script>

4.处理日期显示问题

SimpleDateFormat 格式化
创建一个DateUtil工具类

public class DateUtil {
    public static String format(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(date);
    }
}

重新获取博客创建时间

@Data
public class Blog {
    private Integer id;
    private String title;
    private String content;
    private Integer userId;
    private Integer deleteFlag;
    private Date createTime;

    public String getCreateTime() {
        return DateUtil.format(createTime);
    }
}

5.处理裁剪摘要问题

博客列表页面应该显示的是正文的摘要,并非全部显示出来,在博客的详情页面才需要全部显示出来
修改Blog Service中的方法

    /**
     * 查询所有未删除的博客.按照时间降序排列
     * @return
     */
    public List<Blog> selectAllBlog() {
        List<Blog> blogs = blogMapper.selectAllBlog();
        // 遍历如果博客的正文长度超过100,就裁剪
        for (Blog blog : blogs) {
            if (blog.getContent().length() > 100) {
                blog.setContent(blog.getContent().substring(0,100)+"...");
            }
        }
        return blogs;
    }

4.博客列表界面显示成功

在这里插入图片描述

8.实现博客详情

点击查看全文能进入当前博客详情页面,根据博客id动态的获取博客详情

1.约定前后端交互接口

【请求】

  • blog/getBlogDetails

【响应】

  1. [200]
  • [200]返回数据成功,显示博客详情
  • [-1]该博客不存在
  1. [401]没有权限访问
  2. [error]访问出现错误,打印异常信息

浏览器给服务器发送一个blog.getDetails的Http请求,服务器返回给浏览器一个json格式的数据

2.实现服务器代码

    @RequestMapping("/blog/getBlogDetails")
    public Result getDetails(Integer blogId) {
        // 判合法
        if (blogId == null || blogId <= 0) {
            return Result.fail(-1,"博客不存在");
        }
        Blog blog = blogService.selectByBlogId(blogId);
        if (blog == null) {
            return Result.fail(-1,"博客不存在");
        }
        return Result.success(blog);
    }

使用postman测试成功,服务器正确返回数据
在这里插入图片描述

3.实现客户端代码

  1. 使用ajax,根据当前页面的URL中的blogId参数(使⽤ location.search 即可得到形如 ?blogId=1 的数据),给服务器发送请求
  2. 服务器返回一个json数据格式的响应
  3. 前端根据这个响应使用通过 editor.md 转换成 html, 并显示

1. 引⼊ editor.md

    <!-- 引⼊ editor.md 的依赖 -->
    <link rel="stylesheet" href="blog-editormd/css/editormd.css" />
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js">
    </script>
    <script src="blog-editormd/lib/marked.min.js"></script>
    <script src="blog-editormd/lib/prettify.min.js"></script>
    <script src="blog-editormd/editormd.js"></script>

2.新增 js 代码, 从服务器获取博客详情数据

    <script>
        $.ajax({
            type: "get",
            url: "/blog/getBlogDetails" + location.search,
            success: function (result) {
                console.log(result);
                if (result.code == 200 && result.data != null) {
                    $(".title").text(result.data.title);
                    $(".date").text(result.data.createTime);
                    editormd.markdownToHTML("content", {
                        markdown: result.data.content,
                    });
                } else {
                    alert(result.msg);
                }
            },
            error: function () {
                console.log('访问出错');
            }
        });

    </script>

4.博客列表界面显示成功

9.实现登陆

  • 登录页面提供一个form表单,通过form的方式把用户名密码提交给服务器
  • 服务器端验证⽤户名密码是否正确
  • 如果密码正确, 则在服务器端创建 Session , 并把 sessionId 通过 Cookie 返回给浏览器
  • 前后端分离的项⽬中, 虽然主要使⽤ ajax 进⾏前后端交互, 但是也不是完全不能⽤ form
    

1.约定前后端交互接口

【请求】

  • user/login

【响应】

  1. [200]
  • [200] 登陆成功
  • [-1] 用户名或密码不能为空
  • [-2] 用户名或密码错误
  1. [error]访问出现错误,打印异常信息

2.实现服务器代码

创建 UserController

@RequestMapping("/user")
@RestController
public class UserController {
    
    @Autowired
    private UserService userService;

	@RequestMapping("/login")
    public Result login(String username, String password) {
        // 判空
        if (!StringUtils.hasLength(username) || !StringUtils.hasLength(password)) {
            return Result.fail(-1,"用户名或密码不能为空");
        }
        // 判断用户名密码是否匹配
        User user = userService.selectByName(username);
        if (user == null || !user.getPassWord().equals(password)) {
            return Result.fail(-2,"用户名或密码错误");
        }
        return Result.success("登陆成功");
    }
}

使用postman测试登录成功

在这里插入图片描述

3.实现客户端代码

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <script>
        function login() {
            $.ajax({
                type: "post",
                url: "/user/login",
                data: {
                    "username": $("#username").val(),
                    "password": $("#password").val()
                },
                success: function (result) {
                    if (result.code == 200 && result.data == 1) {
                        location.assign("blog_list.html");
                    } else if(result.code == -1){
                        alert("⽤户名或密码不能为空");
                        return;
                    } else if(result.code == -2){
                        alert("⽤户名或密码错误");
                        return;
                    }
                },
                error : function (error) {
                    console.log(error.msg);
                }
            })
        }
    </script>

3.实现客户端代码

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <script>
        function login() {
            $.ajax({
                type: "post",
                url: "/user/login",
                data: {
                    "username": $("#username").val(),
                    "password": $("#password").val()
                },
                success: function (result) {
                    if(result.code == -1){
                        alert(result.msg);
                    } else if(result.code == -2){
                        alert(result.msg);
                    }
                    else if (result.code == 200 && result.data != null) {
                        location.assign("blog_list.html");
                    }
                },
                error : function (error) {
                    console.log(error.msg);
                }
            })
        }
    </script>

4.登陆功能实现成功

在这里插入图片描述
剩下的功能在下篇博客实现~

  • 5
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
当前课程中博客项目的实战源码是我在 GitHub上开源项目 My-Blog,目前已有 3000 多个 star:本课程是一个 Spring Boot 技术栈的实战类课程,课程共分为 3 大部分,前面两个部分为基础环境准备和相关概念介绍,第三个部分是 Spring Boot 个人博客项目功能的讲解,通过本课程的学习,不仅仅让你掌握基本的 Spring Boot 开发能力以及 Spring Boot 项目的大部分开发使用场景,同时帮你提前甄别和处理掉将要遇到的技术难点,认真学完这个课程后,你将会对 Spring Boot 有更加深入而全面的了解,同时你也会得到一个大家都在使用的博客系统源码,你可以根据自己的需求和想法进行改造,也可以直接使用它来作为自己的个人网站,这个课程一定会给你带来巨大的收获。作者寄语本课程录制于 2020 年,代码基于 Spring Boot 2.x 版本。到目前为止,Spring Boot 技术栈也有一些版本升级,比如 Spring Boot 2.7 发版、Spring Boot 3.x 版本发布正式版本。对于这些情况,笔者会在本课程实战项目的开源仓库中创建不同的代码分支,保持实战项目的源码更新,保证读者朋友们不会学习过气的知识点。课程特色 课程内容紧贴 Spring Boot 技术栈,涵盖大部分 Spring Boot 使用场景。开发教程详细完整、文档资源齐全、实验过程循序渐进简单明了。实践项目页面美观且实用,交互效果完美。包含从零搭建项目、以及完整的后台管理系统博客展示系统两个系统的功能开发流程。技术栈新颖且知识点丰富,学习后可以提升大家对于知识的理解和掌握,对于提升你的市场竞争力有一定的帮助。实战项目预览    
### 回答1: 基于Spring Boot个人博客系统项目源码是一个用于构建个人博客网站的开源项目。它提供了一个完整的后台管理和前台展示功能,可以方便地构建和管理自己的博客网站。 该项目的源码使用Spring Boot框架进行开发,借助Spring Boot的快速开发特性,可以快速搭建起一个功能完善的个人博客系统Spring Boot提供了许多开箱即用的功能和便捷的配置方式,使得开发者可以专注于具体业务逻辑的实现,而不需要过多关注项目的架构和配置。 个人博客系统的源码包含了后台管理部分和前台展示部分。后台管理部分提供了一系列管理功能,包括文章管理、标签管理、分类管理、评论管理等。管理员可以通过后台管理界面对博客文章进行发布、编辑和删除,管理标签和分类,审核评论等操作。 前台展示部分是博客网站的实际展示页面,包括文章列表、文章详情、分类列表、标签列表等页面。用户可以通过前台页面浏览已发布的博客文章,查看文章详情,查找特定标签和分类的文章等。 源码中使用了MySQL数据库来存储博客的数据,并使用了MyBatis作为持久层框架,简化了数据库操作的过程。同时,还使用了Thymeleaf模板引擎来实现前台页面的渲染。 该项目的源码还提供了一些其他功能和特性,比如用户注册和登录、验证码生成和验证、文件上传和下载等。所有的功能都经过了良好的设计和封装,可以方便地进行二次开发和定制。 总之,基于Spring Boot个人博客系统项目源码提供了一个完整的博客网站解决方案,使得构建和管理个人博客网站变得更加简单和高效。通过该源码,可以快速搭建起一个功能完善的个人博客网站,并进行二次开发和定制。 ### 回答2: 基于Spring Boot个人博客系统项目源码是一个开源的代码库,用于构建一个完整的个人博客系统。该项目源码包含了一系列的功能模块和技术实现,使用户能够方便地创建、编辑和管理自己的博客内容。 该项目源码的主要特点包括: 1. 使用Spring Boot框架:Spring Boot是一个快速构建应用程序的框架,可以大大简化开发流程并提高代码质量。该项目源码采用了Spring Boot作为主要开发框架,可以快速搭建整个博客系统。 2. 支持用户认证和授权:该项目源码实现了用户认证和授权功能,只有经过认证的用户才能进行博客的编辑和管理操作。用户可以注册新账户并进行登录操作,系统会自动为每个用户分配一个唯一的身份标识。 3. 支持博客的创建和编辑:用户登录后可以点击新建博客按钮,进入博客编辑页面。用户可以填写博客的标题、内容和标签等信息,并可以上传图片或视频作为博客的附加内容。编辑完成后,用户可以保存草稿或立即发布博客。 4. 支持博客的浏览和评论:用户可以在系统主页上浏览最新的博客内容,并且可以对感兴趣的博客进行评论和点赞操作。系统会对博客进行分页处理,方便用户阅读和浏览。 5. 支持博客的搜索和分类:该项目源码实现博客内容的搜索和分类功能,用户可以根据关键词进行搜索,也可以通过标签或分类进行博客的筛选。系统会根据用户的搜索行为进行相关博客的推荐。 总之,基于Spring Boot个人博客系统项目源码提供了一套完整的博客管理解决方案,用户可以通过该项目源码快速构建自己的个人博客系统,并实现博客的创建、编辑、浏览和评论功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值