增加微服务优化选项,可关闭一些不需要的功能开关,包括如下:1、可关闭根据模块状态去更新相连的菜单状态(menu.updateStatusByModuleStatus=false);

2、可关闭国际化管理(lang.enabled=false);3、可关闭任务调度功能(job.enabled=false);4、可关闭核心模块的Web功能(web.core.enabled=false);减少加载启动时间,控制在10秒内;
This commit is contained in:
thinkgem
2018-08-19 11:05:29 +08:00
parent 55bc4dd3ad
commit b195480441
12 changed files with 54 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -34,6 +35,7 @@ import com.jeesite.modules.sys.utils.UserUtils;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/area")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class AreaController extends BaseController {
@Autowired

View File

@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -39,6 +40,7 @@ import com.jeesite.modules.sys.utils.UserUtils;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/company")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class CompanyController extends BaseController {
@Autowired

View File

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -29,6 +30,7 @@ import com.jeesite.modules.sys.service.LogService;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/log")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class LogController extends BaseController {
@Autowired

View File

@@ -8,6 +8,7 @@ import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -35,6 +36,7 @@ import com.jeesite.modules.sys.web.user.EmpUserController;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/office")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class OfficeController extends BaseController {
@Autowired

View File

@@ -17,6 +17,7 @@ import org.apache.shiro.session.Session;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.support.DefaultSubjectContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -41,6 +42,7 @@ import com.jeesite.modules.sys.utils.UserUtils;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/online")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class OnlineController extends BaseController{
@Autowired

View File

@@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -29,6 +30,7 @@ import com.jeesite.modules.sys.service.PostService;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/post")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class PostController extends BaseController {
@Autowired

View File

@@ -9,6 +9,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
@@ -34,6 +35,7 @@ import com.jeesite.modules.sys.utils.ValidCodeUtils;
*/
@Controller
@RequestMapping(value = "/account")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class AccountController extends BaseController{
@Autowired

View File

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -35,6 +36,7 @@ import com.jeesite.modules.sys.utils.UserUtils;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/corpAdmin")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class CorpAdminController extends BaseController {
@Autowired

View File

@@ -13,6 +13,7 @@ import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -54,6 +55,7 @@ import com.jeesite.modules.sys.utils.UserUtils;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/empUser")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class EmpUserController extends BaseController {
@Autowired

View File

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -32,6 +33,7 @@ import com.jeesite.modules.sys.service.UserService;
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/secAdmin")
@ConditionalOnProperty(name="web.core.enabled", havingValue="true", matchIfMissing=true)
public class SecAdminController extends BaseController {
@Autowired

View File

@@ -179,9 +179,19 @@ user:
registerUser:
enabled: false
userTypes: 0, 1
# 菜单管理
menu:
# 根据模块状态去更新相连的菜单状态仅作为微服务时设为false
updateStatusByModuleStatus: true
# 国际化管理(专业版+
lang:
enabled: true
# 任务调度(个人版+
job:
enabled: true
# 是否自动启动任务调度(可关闭)
autoStartup: true
@@ -396,6 +406,10 @@ web:
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
# 错误页面500.html是否输出错误信息正式环境为提供安全性可设置为false
error:

View File

@@ -14,12 +14,6 @@ copyrightYear: 2018
#是否演示模式
demoMode: false
#是否小程序
miniService: true
#是否小程序
miniConfig: true
#============================#
#===== Database sttings =====#
#============================#
@@ -208,8 +202,18 @@ jdbc:
# # 多租户模式SAAS模式专业版
# useCorpModel: false
# 菜单管理
#menu:
# # 根据模块状态去更新相连的菜单状态仅作为微服务时设为false
# updateStatusByModuleStatus: true
# 国际化管理(专业版+
#lang:
# enabled: true
# 任务调度(个人版+
#job:
# enabled: true
#
# # 是否自动启动任务调度(可关闭)
# autoStartup: true
@@ -385,6 +389,16 @@ jdbc:
#
# # 静态文件后缀排除的url路径指定哪些uri路径不进行静态文件过滤。
# staticFileExcludeUri: /druid/
#
# # 自定义正则表达式验证(主键、登录名)
# 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
#
# 错误页面500.html是否输出错误信息正式环境为提供安全性可设置为false
#error: