一个使用Spring Boot + MyBatis + FreeMarker实现的博客系统。
演示网址: https://blog.hongjian.tech
首先此博客系统是根据Tale修改而来,主要是将后台实现替换成了Spring Boot+MyBatis+FreeMarker,同时根据自己的需求做了一些功能上的增删, 在此也要感谢Tale的作者@biezhi写出了这么棒的项目。
项目主要使用到的框架和技术有:
- Spring Boot
- MyBatis
- MyBatis通用mapper
- FreeMarker
- Mybatis-PageHelper
- Druid
- clone此项目
$ git clone https://github.com/xiahongjian/boot-blog.git - 创建数据库及表
执行boot-blog/src/resources/schema-mysql.sql中的SQL创建数据库及表。 执行boot-blog/src/resources/data.sql中的SQL插入基本数据。
- 编译打包项目
$ cd /your/path/boot-blog $ mvn package 执行完后,在target目录下会有boot-blog.jar,此jar包为打包好的项目。
- 编辑配置文件
在boot-blog.jar的同级目录下创建application-prod.yml
server: port: 8080 spring: datasource: driver-class-name: com.mysql.jdbc.Driver # Your database link url: jdbc:mysql://127.0.0.1:3306/Blog?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: yourname password: yourpassword druid: stat-view-servlet: login-username: yourname login-password: yourpassword logging: level: hongjian.tech.blog: info # mapper mapper: indentity: MYSQL # pagehelper pagehelper: helperDailect: mysql- 启动
$ java -jar boot-blog.jar --spring.profiles.active=prod 访问http://localhost:8080完成博客安装相关配置。