JeeSite使用(一)大步跑起來


背景:近期准備換個工作,想對之前自己寫的代碼進行重構,選擇了JeeSite

需求:跑起來才是硬道理

方法:1.官方文檔有坑,別信他

      2.官方文檔有坑,別信他

      3.官方文檔有坑,別信他

一、檢出項目

 

git clone https://gitee.com/thinkgem/jeesite4.git

 

二、個性化配置

  1、修改文件夾名為 myjeesite 

   2、IDEA —— Import Project —— myjeesit/root/pom.xml —— NEXT —— 勾選【Import Maven projects automatically—— 一路NEXT —— FINISH

   3、配置application.yml

 

#======================================#
#========== Project settings ==========#
#======================================#

# 產品或項目名稱、軟件開發公司名稱
productName: myjeesite
companyName: ThinkGem

# 產品版本、版權年份
productVersion: V4.1
copyrightYear: 2018

#是否演示模式
demoMode: false

#======================================#
#========== Server settings ===========#
#======================================#

server:

  port: 8980
  servlet:
    context-path: /jessite-web
  tomcat:
    uri-encoding: UTF-8
    
#======================================#
#========== Database sttings ==========#
#======================================#

# 數據庫連接
jdbc: 
  
  # Mysql 數據庫配置
  type: mysql
  driver: com.mysql.jdbc.Driver
  url: jdbc:mysql://192.168.0.131:3306/jeesite?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
  username: root
  password: root
  testSql: SELECT 1

#  # Oracle 數據庫配置
#  type: oracle
#  driver: oracle.jdbc.driver.OracleDriver
#  url: jdbc:oracle:thin:@127.0.0.1:1521/orcl
#  username: jeesite
#  password: jeesite
#  testSql: SELECT 1 FROM DUAL

#  # Sql Server 數據庫配置
#  type: mssql
#  driver: net.sourceforge.jtds.jdbc.Driver
#  url: jdbc:jtds:sqlserver://127.0.0.1:1433/jeesite
#  username: jeesite
#  password: jeesite
#  testSql: SELECT 1

#  # PostgreSql 數據庫配置
#  type: postgresql
#  driver: org.postgresql.Driver
#  url: jdbc:postgresql://127.0.0.1:5432/jeesite
#  username: jeesite
#  password: jeesite
#  testSql: SELECT 1

#  # 連接信息加密
#  encrypt:
#  
#    # 加密連接用戶名
#    username: false
#    # 加密連接密碼
#    password: true
#
#  # 數據庫連接池配置
#  pool:
#  
#    # 初始化連接數
#    init: 1
#    # 最小連接數
#    minIdle: 3
#    # 最大連接數
#    maxActive: 20  # 數據庫連接池配置
#
#    # 獲取連接等待超時時間,單位毫秒(1分鍾)(4.0.6+)
#    maxWait: 60000
#    
#    # 從池中取出連接前進行檢驗,如果檢驗失敗,則從池中去除連接並嘗試取出另一個(4.0.6+)
#    testOnBorrow: false
#    testOnReturn: false
#    
#    # 間隔多久才進行一次檢測,檢測需要關閉的空閑連接,單位毫秒(1分鍾)(4.0.6+)
#    timeBetweenEvictionRunsMillis: 60000
#    
#    # 一個連接在池中最小空閑的時間,單位毫秒(20分鍾)(4.0.6+)
#    minEvictableIdleTimeMillis: 1200000
#    # 一個連接在池中最大空閑的時間,單位毫秒(30分鍾)(4.1.2+)
#    maxEvictableIdleTimeMillis: 1800000
#    
#    # 是否自動回收泄露的連接和超時時間,單位秒(35分鍾)(4.0.6+)
#    removeAbandoned: true
#    removeAbandonedTimeout: 2100
#
#    # Oracle 下會自動開啟 PSCache,並指定每個連接上 PSCache 大小。若不指定,則與 maxActive 相同(4.1.5+)
#    maxPoolPreparedStatementPerConnectionSize: ~

#  # 多數據源名稱列表,多個用逗號隔開,使用方法:@MyBatisDao(dataSourceName="ds2")
#  dataSourceNames: ds2
#  
#  # 多數據源配置:ds2
#  ds2:
#    type: mysql
#    driver: com.mysql.jdbc.Driver
#    url: jdbc:mysql://127.0.0.1:3306/jeesite2?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
#    username: root
#    password: 123456
#    testSql: SELECT 1
#    encrypt:
#      username: false
#      password: true
#    pool:
#      init: 1
#      minIdle: 3
#      maxActive: 20
      
#  # JTA 分布式事務(v4.0.4+)
#  jta:
#    enabled: false
#  注意:如果報  oracle.jdbc.xa.OracleXAResource.recover 錯誤,則需要授權如下:
#  grant select on sys.dba_pending_transactions to jeesite;
#  grant select on sys.pending_trans$ to jeesite;
#  grant select on sys.dba_2pc_pending to jeesite;
#  grant execute on sys.dbms_system to jeesite;

#  # 事務超時時間,單位秒(30分鍾)(v4.1.5+)
#  transactionTimeout: 1800

#  # 表名前綴
#  tablePrefix: js_

#======================================#
#========== Spring settings ===========#
#======================================#

spring:
  
  # 應用程序名稱
  application:
    name: jeesite-web
    
  # 當前環境名稱(注意:不可設置為 test 它是單元測試專用的名稱)
  profiles:    
    active: default
    
  # 打印橫幅
  main:
    bannerMode: "off"
    
#  # Redis 連接參數 (RedisProperties)
#  redis:
#    host: 127.0.0.1
#    port: 6379
#    ssl: false
#    database: 0
#    password: 1234
#    timeout: 2000
#    lettuce:
#      pool:
#        # 最大空閑連接數
#        maxIdle: 3
#        # 最大活動連接數
#        maxActive: 20

#  # 緩存配置
#  cache:
#    # 緩存及會話共享(專業版)
#    isClusterMode: false
#    # 清理全部緩存按鈕所清理的緩存列表
#    clearNames: sysCache,corpCache,userCache,cmsCache,msgPcPoolCache

# 日志配置
logging:
  config: classpath:config/logback-spring.xml
  
#======================================#
#========== System settings ===========#
#======================================#

# 管理基礎路徑
#adminPath: /a

# 前端基礎路徑
#frontPath: /f

# 分頁相關
#page:
#
#  # 分頁默認大小
#  pageSize: 20

# 用戶相關
#user:
#
#  # 指定超級管理員編號(研發團隊使用的賬號)
#  superAdminCode: system
#
#  # 超級管理員獲取菜單的最小權重(默認20;>=40二級管理員;>=60系統管理員;>=80超級管理員)
#  superAdminGetMenuMinWeight: 40
#
#  # 系統管理員角色編號(客戶方管理員使用的角色)
#  corpAdminRoleCode: corpAdmin
#
#  # 用戶類型配置信息(employee員工,member會員,btype往來單位,persion個人,expert專家,...),JSON 格式說明如下:
#  # {"用戶類型":{"dao":"Dao的Bean名稱","loginView":"登錄頁面視圖","indexView":"主框架頁面視圖,支持 redirect: 前綴"}}
#  userTypeMap: >
#    {
#      "employee":{"dao":"employeeDao","loginView":"","indexView":"modules/sys/sysIndex"},
#      "member":{"dao":"memberDao","loginView":"","indexView":"modules/sys/sysIndexMember"},
#      "btype":{"dao":"btypeInfoDao","loginView":"","indexView":"modules/sys/sysIndexBtype"},
#      "expert":{"dao":"expertDao","loginView":"","indexView":"modules/sys/sysIndexExpert"}
#    }
#
#  # 數據權限設置參數,可新增自定義數據權限,moduleCode: 針對模塊, ctrlPermi: 權限類型, 0全部  1擁有權限  2管理權限
#  dataScopes: >
#    [{
#      moduleCode: "core",
#      ctrlPermi: "0",
#      ctrlName: "機構權限",
#      ctrlName_en: "Office",
#      ctrlType: "Office",
#      ctrlDataUrl: "/sys/office/treeData",
#      chkboxType: {"Y":"ps","N":"ps"},
#      expandLevel: -1,
#      remarks: ""
#    },{
#      moduleCode: "core",
#      ctrlName: "公司權限",
#      ctrlName_en: "Company",
#      ctrlType: "Company",
#      ctrlPermi: "0",
#      ctrlDataUrl: "/sys/company/treeData",
#      chkboxType: {"Y":"ps","N":"ps"},
#      expandLevel: -1,
#      remarks: ""
#    },{
#      moduleCode: "core",
#      ctrlName: "角色權限",
#      ctrlName_en: "Role",
#      ctrlType: "Role",
#      ctrlPermi: "2",
#      ctrlDataUrl: "/sys/role/treeData",
#      chkboxType: {"Y":"ps","N":"ps"},
#      expandLevel: -1,
#      remarks: ""
#    }]
#    
#  # 管理功能的控制權限類型(1擁有的權限 2管理的權限)(v4.1.5+)
#  adminCtrlPermi: 2
#
#  # 多租戶模式(SAAS模式)(專業版)
#  useCorpModel: false

# 菜單管理
#menu:
#  # 根據模塊狀態去更新相連的菜單狀態(僅作為微服務時設為false)
#  updateStatusByModuleStatus: true

# 國際化管理(專業版)
#lang:
#  enabled: false
#  
#  # 默認語言(4.1.3+)
#  defaultLocale: zh_CN
#  # 默認時區(4.1.3+)
#  defaultTimeZone: GMT+08:00
  
# 任務調度(個人版)
#job:
#  enabled: false
#
#  # 是否自動啟動任務調度(可關閉)
#  autoStartup: true
#
#  # 任務調度啟動延遲設置(單位:秒)(建議設置項目啟動完成后的時間)
#  startupDelay: 60
#  
#  # 任務調度線程池
#  threadPool:
#    threadCount: 10
#    threadPriority: 5
#
#  # 調度設置,集群中每一個實例都必須使用相同的instanceName名稱 (區分特定的調度器實例)
#  # 每一個instanceId必須不同,設置AUTO則自動生成
#  scheduler:
#    instanceName: JeeSiteScheduler
#    instanceId: AUTO
#
#  # 任務調度集群設置
#  jobStore:
#    isClustered: true
#    dataSourceName: job
#    clusterCheckinInterval: 1000
#
#  # 調度日志
#  log:
#    # 計划調度日志
#    scheduler:
#      enabled: true
#      # 是否只保存錯誤日志
#      errorLevel: true
#    # 任務執行日志
#    jobDetail:
#      enabled: true
#      # 是否只保存錯誤日志
#      errorLevel: true
#    # 計划觸發日志
#    trigger:
#      enabled: false

# 代碼生成
#gen:
#  enabled: true

# 系統監控
#state:
#  enabled: true

#======================================#
#========= Framework settings =========#
#======================================#

# Shiro 相關配置
#shiro:
#
#  #索引頁路徑
#  defaultPath: ${shiro.loginUrl}
#
#  # 登錄相關設置
#  loginUrl: ${adminPath}/login
#  logoutUrl: ${shiro.loginUrl}
#  successUrl: ${adminPath}/index
#
##  # Apereo CAS 相關配置(個人版)
##  casServerUrl: http://127.0.0.1:8981/cas
##  casClientUrl: http://127.0.0.1:8980/js
##  loginUrl: ${shiro.casServerUrl}?service=${shiro.casClientUrl}${adminPath}/login-cas
##  logoutUrl: ${shiro.casServerUrl}/logout?service=${shiro.loginUrl}
##  successUrl: ${shiro.casClientUrl}${adminPath}/index
#
#  # 簡單 SSO 登錄相關配置
#  sso:
#  
#    # 如果啟用/sso/{username}/{token}單點登錄,請修改此安全key並與單點登錄系統key一致。
#    secretKey: ~
#
#    # 是否加密單點登錄安全Key
#    encryptKey: true
#
#  # 登錄提交信息加密(如果不需要加密,設置為空即可)
#  loginSubmit:
#    
#    # 登錄提交信息安全Key,加密用戶名、密碼、驗證碼,后再提交(key設置為3個,用逗號分隔)
#    secretKey: thinkgem,jeesite,com
#  
#  # 記住我密鑰設置(設置為空則使用默認)
#  rememberMe:
#    # 密鑰必須通過 com.jeesite.common.shiro.web.RememberMeManager 的main方法生成
#    secretKey: ~
#  
#  # 指定獲取客戶端IP的Header名稱,防止IP偽造。指定為空,則使用原生方法獲取IP。
#  remoteAddrHeaderName: X-Forwarded-For
#  
#  # 允許的請求方法設定,解決安全審計問題
#  allowRequestMethods: GET,POST
#  
#  # 是否允許賬號多地登錄,如果設置為false,同一個設備類型的其它地點登錄的相同賬號被踢下線
#  isAllowMultiAddrLogin: true
#  
#  # 是否允許多賬號多設備登錄,如果設置為false,其它地點登錄的相同賬號全部登錄設備將被踢下線
#  isAllowMultiDeviceLogin: true
#  
#  # 是否允許刷新主框架頁,如果設置為false,刷新主頁將導致重新登錄。如安全性比較高的,如銀行個人首頁不允許刷新。
#  isAllowRefreshIndex: true
#  
#  # 是否允許嵌入到外部網站iframe中(true:不限制,false:不允許)
#  isAllowExternalSiteIframe: true
#  
#  # 是否允許跨域訪問,如果允許,設置允許的域名,全部域名設置*號,如果不允許,此設置應該為空
##  accessControlAllowOrigin: http://demo.jeesite.com
##  accessControlAllowOrigin: '*'
#
#  # 是否允許接收跨域的Cookie憑證數據
##  accessControlAllowCredentials: true
#
#  # 允許的網站來源地址,不設置為全部地址(避免一些跨站點請求偽造CSRF)
#  allowReferers: http://127.0.0.1,http://localhost
#  allowReferers: ~
#
#  # 是否在登錄后生成新的Session(默認false)
#  isGenerateNewSessionAfterLogin: false
#
#  # 內部系統訪問過濾器,可設置多個允許的內部系統IP地址串,多個用逗號隔開
#  innerFilter.allowIp: 127.0.0.1
#  
#  # URI 權限過濾器定義
#  filterChainDefinitions: |
#    /ReportServer/** = user
#    ${adminPath}/** = user

# Session 相關
#session:
#
#  # 全局會話超時,單位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms, 12h=43200000ms, 1day=86400000ms
#  sessionTimeout: 1800000
#  
#  # 手機APP設備會話超時參數設置,登錄請求參數加 param_deviceType=mobileApp 時有效
#  mobileAppSessionTimeout: 43200000
#  
#  # 定時清理失效會話,清理用戶直接關閉瀏覽器造成的孤立會話
#  sessionTimeoutClean: 1200000
#  
#  # 會話唯一標識SessionId在Cookie中的名稱。
#  sessionIdCookieName: jeesite.session.id
#  
#  # 共享的SessionId的Cookie名稱,保存到跟路徑下,第三方應用獲取。同一域名下多個項目時需設置共享Cookie的名稱。
#  #shareSessionIdCookieName: ${session.sessionIdCookieName}

# MyBatis 相關
#mybatis:
#
#  # @MyBatisDao、Aliases 掃描基礎包,如果多個,用“,”分隔
#  scanBasePackage: com.jeesite.modules
#  
#  # TypeHandlers 掃描基礎包,如果多個,用“,”分隔
#  scanTypeHandlersPackage: ~
#  
#  # Mapper文件刷新線程
#  mapper:
#    refresh:
#      enabled: true
#      delaySeconds: 60
#      sleepSeconds: 3
#      mappingPath: mappings
  
# Web 相關
#web:
#  
#  # MVC 視圖相關
#  view:
#    
#    # 系統主題名稱,主題視圖優先級最高,如果主題下無這個視圖文件則訪問默認視圖
#    # 引入頁面頭部:'/themes/'+themeName+'/include/header.html'
#    # 引入頁面尾部:'/themes/'+themeName+'/include/footer.html'
#    themeName: default
#
#  # MVC 攔截器
#  interceptor:
#    
#    # 后台管理日志記錄攔截器
#    log:
#      enabled: true
#      addPathPatterns: >
#        ${adminPath}/**
#      excludePathPatterns: >
#        ${adminPath}/index,
#        ${adminPath}/login,
#        ${adminPath}/desktop,
#        ${adminPath}/index/menuTree,
#        ${adminPath}/sys/online/count,
#        ${adminPath}/state/server/rtInfo,
#        ${adminPath}/**/treeData,
#        ${adminPath}/file/**,
#        ${adminPath}/tags/*,
#        ${adminPath}/msg/**
#    
#    # 前台自動切換到手機視圖攔截器
#    mobile:
#      enabled: false
#      addPathPatterns: >
#        ${frontPath}/**
#      excludePathPatterns: ~
#        
#  # 靜態文件后綴,過濾靜態文件,以提高訪問性能。
#  staticFile: .css,.js,.map,.png,.jpg,.gif,.jpeg,.bmp,.ico,.swf,.psd,.htc,.crx,.xpi,.exe,.ipa,.apk,.otf,.eot,.svg,.ttf,.woff,.woff2
#  
#  # 靜態文件后綴,排除的url路徑,指定哪些uri路徑不進行靜態文件過濾。
#  staticFileExcludeUri: /druid/
#  
#  # 靜態資源路徑前綴,可做CDN加速優化
#  staticPrefix: /static
#  
#  # 嚴格模式(更嚴格的數據安全驗證)
#  strictMode: false
#  
#  # 自定義正則表達式驗證(主鍵、登錄名)
#  validator:
#    id: '[a-zA-Z0-9_\-/#\u4e00-\u9fa5]{0,64}'
#    user.loginCode: '[a-zA-Z0-9_\u4e00-\u9fa5]{4,20}'
#    
#  # 核心模塊的Web功能(僅作為微服務時設為false)
#  core: 
#    enabled: true
#  
#  # 在線API文檔工具
#  swagger: 
#    enabled: true

# 錯誤頁面500.html是否輸出錯誤信息(正式環境,為提供安全性可設置為false)
#error:
#  page:
#    printErrorInfo: true

#======================================#
#======== FileUpload settings =========#
#======================================#

#file:
#  enabled: true
#
#  # 文件上傳根路徑,設置路徑中不允許包含“userfiles”,在指定目錄中系統會自動創建userfiles目錄,如果不設置默認為contextPath路徑
##  baseDir: D:/jeesite
#
#  # 上傳文件的相對路徑(支持:yyyy, MM, dd, HH, mm, ss, E)
#  uploadPath: '{yyyy}{MM}/'
#  
#  # 上傳單個文件最大字節(500M),在這之上還有 > Tomcat限制 > Nginx限制,等。
#  maxFileSize: 500*1024*1024
#  
#  # 設置允許上傳的文件后綴
#  imageAllowSuffixes: .gif,.bmp,.jpeg,.jpg,.ico,.png,.tif,.tiff,
#  mediaAllowSuffixes: .flv,.swf,.mkv,webm,.mid,.mov,.mp3,.mp4,.m4v,.mpc,.mpeg,.mpg,.swf,.wav,.wma,.wmv,.avi,.rm,.rmi,.rmvb,.aiff,.asf,.ogg,.ogv,
#  fileAllowSuffixes: .doc,.docx,.rtf,.xls,.xlsx,.csv,.ppt,.pptx,.pdf,.vsd,.txt,.md,.xml,.rar,.zip,7z,.tar,.tgz,.jar,.gz,.gzip,.bz2,.cab,.iso,.ipa,.apk,
#  
#  # 允許上傳的文件內容類型(圖片、word、excel、ppt)防止修改后綴惡意上傳文件(默認不啟用驗證)
##  allowContentTypes: image/jpeg,image/gif,image/bmp,image/png,image/x-png,
##    application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,
##    application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
##    application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation
#
#  # 是否開啟分片上傳
#  chunked: false
#  # 分片大小,單位字節(10M)
#  chunkSize: 10485760
#  # 最大上傳線程數
#  threads: 1
#
#  # 是否用文件流方式下載(支持斷點續傳)
#  isFileStreamDown: true
  
#視頻轉碼
#video:
#
#  # 視頻格式轉換  ffmpeg.exe 所放的路徑
#  ffmpegFile: d:/tools/video/ffmpeg-4.9/bin/ffmpeg.exe
##  ffmpegFile: d:/tools/video/libav-10.6-win64/bin/avconv.exe
#  
#  # 視頻格式轉換  mencoder.exe 所放的路徑
#  mencoderFile: d:/tools/video/mencoder-4.9/mencoder.exe
#  
#  # 將mp4視頻的元數據信息轉到視頻第一幀
#  qtFaststartFile: d:/tools/video/qt-faststart/qt-faststart.exe

#======================================#
#========== Message settings ==========#
#======================================#

# 消息提醒中心(專業版)
#msg:
#  enabled: true
#  
#  # 是否開啟實時發送消息(保存消息后立即檢查未讀消息並發送),分布式部署下請單獨配置消息發送服務,不建議開啟此選項。
#  realtime:
#    # 是否開啟
#    enabled: true

#  # 推送失敗次數,如果推送次數超過了設定次數,仍不成功,則放棄並保存到歷史
#  pushFailNumber: 3
  
#  # 郵件發送參數
#  email:
#    beanName: emailSendService
#    fromAddress: test@163.com
#    fromPassword: 123456
#    fromHostName: smtp.163.com
#    sslOnConnect: false
#    sslSmtpPort: 994
#
#  # 短信網關
#  sms:
#    beanName: smsSendService
#    url: http://localhost:80/msg/sms/send
#    data: username=jeesite&password=jeesite.com
#    prefix: 【JeeSite】
#    suffix: ~

#======================================#
#========== Project settings ==========#
#======================================#

 

 

 

   4、初始化數據庫用web里的 init-data.sh 會報錯,所以用官方推薦的方法處理(用完之后記得刪,要不然哪天就又初始化了)

          

 

    5、修改后執行可初始化數據庫

    

 

    6、啟動項目(system————admin)

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM