在線 Demo:http://fsblog.letec.topjavascript
Github 地址:https://github.com/jameszbl/fs-blogcss
MySQL
Gradle
gradle clean build
,生成的 jar 包位於 build/libs
目錄下,使用 java -jar .../fsblog.jar
運行application-dev.yml
中配置數據庫用戶名和密碼,默認爲:username: root password: root
application-dev.yml
中配置spring:
# 應用名稱
application:
name: FS-Blog
# 緩存
cache:
cache-names: ehcache
ehcache:
# 緩存的配置文件
config: ehcache.xml
# Spring Boot 熱部署工具
devtools:
restart:
enabled: true
# 模板引擎
freemarker:
enabled: true
cache: false
suffix: .ftl
charset: utf-8
# 邏輯視圖名(全部視圖都要寫在這裏)
view-names: index,
error,
userlogin,
adminlogin,
register,
article,
posts,
admin/index,
admin/userlogin,
admin/blogadd,
admin/blog_manage,
admin/blog_modify,
admin/admin_user_manage,
admin/admin_user_pwd_modify
content-type: text/html
allow-request-override: true
check-template-location: true
expose-request-attributes: true
expose-session-attributes: true
expose-spring-macro-helpers: true
request-context-attribute: request
template-loader-path: classpath:/templates/
# 靜態資源
resources:
chain:
strategy:
content:
enabled: true
# 靜態資源位置
paths: /**
fixed:
enabled: true
paths: /js/lib
version: v12
static-locations: classpath:/static/,classpath:/META-INF/resources/,classpath:/resources/,classpath:/public/
# 數據源
datasource:
type: com.zaxxer.hikari.HikariDataSource
# 數據庫鏈接
# 用戶名
username: root
# 密碼
password: root
# 數據庫 URL
url: jdbc:mysql://127.0.0.1:3306?useUnicode:true&characterEncoding:UTF-8
# 數據庫鏈接驅動
driverClassName: com.mysql.jdbc.Driver
# SQL 編碼
sql-script-encoding: UTF-8
hikari:
# 鏈接存活時間
connection-timeout: 30000
# 鏈接池容量
maximum-pool-size: 50
minimum-idle: 5
# 數據庫定義
schema: classpath:schema.sql
# 測試數據
data: classpath:data.sql
# 是否自動建立數據庫並自動導入初始數據
initialize: true
continue-on-error: true
# 服務器配置
server:
# 端口
port: 8083
max-http-header-size: 8192
compression:
min-response-size: 512
enabled: true
mime-types: text/html,text/css,text/javascript,application/javascript,image/gif,image/png,image/jpg
tomcat:
maxThreads: 12
minSpareThreads: 3
# 訪問日誌
accesslog:
directory: /home/fullstack/app/fullstack
pattern: combined
enabled: true
# 會話
session:
cookie:
# Session 存活時間
max-age: 1800
# 日誌
logging:
# Log4j2 配置文件
config: classpath:log4j2.xml
mybatis:
# 實體類所在包
type-aliases-package: me.zbl.fullstack.entity
# xml 文件位置
mapper-locations: classpath:mapping/*.xml
複製代碼