從零搭建java後臺管理系統(一)框架初步搭建

框架搭建

1、初步設想,使用springboot,框架打算用到依賴

  1. spring web,devTools,mysql,Aspect,Redis,Lombok,Freemark,Shiro,Rabbitmq,MyBatis
  2. 登陸 start.spring.io 自動生成springboot項目,把能加的依賴都加進來
  3. 生成目錄結構以下
    css

  4. 以後再添加些必要依賴,如日誌,數據庫鏈接池,mybaits分頁插件,mybatis自動生成代碼工具等html

2、配置application.properties

#熱部署生效
spring.devtools.restart.enabled=true
# 爲mybatis設置,生產環境可刪除、
restart.include.mapper=/mapper-[\\w-\\.]+jar
restart.include.pagehelper=/pagehelper-[\\w-\\.]+jar

############################################################
#
# REDIS 配置
#
############################################################
# Redis數據庫索引(默認爲0)
spring.redis.database=1
# Redis服務器地址
spring.redis.host=192.168.1.191
# Redis服務器鏈接端口
spring.redis.port=6379
# Redis服務器鏈接密碼(默認爲空)
spring.redis.password=
# 鏈接池最大鏈接數(使用負值表示沒有限制)
spring.redis.pool.max-active=1000
# 鏈接池最大阻塞等待時間(使用負值表示沒有限制)
spring.redis.pool.max-wait=-1
# 鏈接池中的最大空閒鏈接
spring.redis.pool.max-idle=10
# 鏈接池中的最小空閒鏈接
spring.redis.pool.min-idle=2
# 鏈接超時時間(毫秒)
spring.redis.timeout=0


############################################################
#
# 配置數據源相關   使用阿里巴巴的 druid 數據源
#
############################################################
spring.datasource.url=jdbc:mysql://localhost:3306/leecx
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.druid.initial-size=1
spring.datasource.druid.min-idle=1
spring.datasource.druid.max-active=20
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.stat-view-servlet.allow=true


############################################################
#
# mybatis 配置
#
############################################################
# mybatis 配置
mybatis.type-aliases-package=com.tzxylao.manager.pojo
mybatis.mapper-locations=classpath:mapper/*.xml
# 通用 Mapper 配置
mapper.mappers=com.tzxylao.manager.utils.GeneralMapper
mapper.not-empty=false
mapper.identity=MYSQL
# 分頁插件配置
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql


#設定靜態文件路徑,js,css等
spring.mvc.static-path-pattern=/static/**

############################################################
#
# freemarker 靜態資源配置
#
############################################################
#設定ftl文件路徑
spring.freemarker.template-loader-path=classpath:/templates
# 關閉緩存, 即時刷新, 上線生產環境須要改成true
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-location=true
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=true
spring.freemarker.expose-session-attributes=true
spring.freemarker.request-context-attribute=request
spring.freemarker.suffix=.ftl

# session最大超時時間(分鐘),默認爲30分鐘
server.session-timeout=60

# tomcat的URI編碼
server.tomcat.uri-encoding=UTF-8

==接下來說解在阿里雲服務器搭建mysql和redis,先把項目啓動起來==mysql

相關文章
相關標籤/搜索