整体优化
This commit is contained in:
parent
2fa8941998
commit
f26e9b4dbf
|
@ -58,6 +58,8 @@
|
|||
<element id="library" level="project" name="Maven: org.mybatis:mybatis:3.4.1" />
|
||||
<element id="library" level="project" name="Maven: net.sf.ehcache:ehcache-core:2.5.0" />
|
||||
<element id="library" level="project" name="Maven: org.apache.shiro:shiro-ehcache:1.2.2" />
|
||||
<element id="library" level="project" name="Maven: org.apache.shiro:shiro-aspectj:1.4.0" />
|
||||
<element id="library" level="project" name="Maven: org.aspectj:aspectjrt:1.8.10" />
|
||||
<element id="library" level="project" name="Maven: org.slf4j:slf4j-api:1.7.25" />
|
||||
<element id="library" level="project" name="Maven: org.apache.shiro:shiro-core:1.2.3" />
|
||||
<element id="library" level="project" name="Maven: commons-beanutils:commons-beanutils:1.9.3" />
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.apache.shiro:shiro-aspectj:1.4.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/shiro/shiro-aspectj/1.4.0/shiro-aspectj-1.4.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/shiro/shiro-aspectj/1.4.0/shiro-aspectj-1.4.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apache/shiro/shiro-aspectj/1.4.0/shiro-aspectj-1.4.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.aspectj:aspectjrt:1.8.10">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/aspectj/aspectjrt/1.8.10/aspectjrt-1.8.10.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/aspectj/aspectjrt/1.8.10/aspectjrt-1.8.10-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/aspectj/aspectjrt/1.8.10/aspectjrt-1.8.10-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -86,6 +86,8 @@
|
|||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-ehcache:1.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-aspectj:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||
|
|
|
@ -120,4 +120,5 @@ public abstract class BaseServiceImpl <T,E extends Serializable> implements Base
|
|||
ReType reType=new ReType(tPage.getTotal(),tList);
|
||||
return JSON.toJSONString(reType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,6 +88,8 @@
|
|||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-ehcache:1.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-aspectj:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||
|
|
|
@ -45,7 +45,7 @@ public class LogController extends BaseController{
|
|||
* @param limit
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "showLogList",produces = "text/json;charset=UTF-8")
|
||||
@GetMapping(value = "showLogList")
|
||||
@ResponseBody
|
||||
public String showLog(SysLog sysLog, String page, String limit){
|
||||
List<SysLog> tList=null;
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.len.controller;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.len.core.annotation.Log;
|
||||
import com.len.core.shiro.LoginRealm;
|
||||
import com.len.core.shiro.ShiroUtil;
|
||||
import com.len.entity.SysMenu;
|
||||
import com.len.entity.SysUser;
|
||||
|
@ -20,6 +21,7 @@ import org.apache.shiro.authc.IncorrectCredentialsException;
|
|||
import org.apache.shiro.authc.UnknownAccountException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -90,6 +92,7 @@ public class LoginController {
|
|||
String msg=null;
|
||||
try{
|
||||
subject.login(token);
|
||||
subject.hasRole("admin");
|
||||
if(subject.isAuthenticated()){
|
||||
return "/main/main";
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.len.controller;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.len.base.BaseController;
|
||||
import com.len.core.annotation.Log;
|
||||
import com.len.core.annotation.Log.LOG_TYPE;
|
||||
import com.len.entity.SysRole;
|
||||
import com.len.entity.SysRoleMenu;
|
||||
import com.len.entity.SysRoleUser;
|
||||
|
@ -52,7 +53,7 @@ public class RoleController extends BaseController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "/showRoleList", httpMethod = "GET", notes = "展示角色")
|
||||
@GetMapping(value = "showRoleList",produces = "text/json;charset=UTF-8")
|
||||
@GetMapping(value = "showRoleList")
|
||||
@ResponseBody
|
||||
public String showRoleList(SysRole role,Model model,String page,String limit){
|
||||
return roleService.show(role,Integer.valueOf(page),Integer.valueOf(limit));
|
||||
|
@ -78,6 +79,8 @@ public class RoleController extends BaseController {
|
|||
//操作role-menu data
|
||||
SysRoleMenu sysRoleMenu=new SysRoleMenu();
|
||||
sysRoleMenu.setRoleId(sysRole.getId());
|
||||
|
||||
if(menus!=null)
|
||||
for(String menu:menus){
|
||||
sysRoleMenu.setMenuId(menu);
|
||||
roleMenuService.insert(sysRoleMenu);
|
||||
|
@ -122,6 +125,7 @@ public class RoleController extends BaseController {
|
|||
for(SysRoleMenu sysRoleMenu1:menuList){
|
||||
roleMenuService.deleteByPrimaryKey(sysRoleMenu1);
|
||||
}
|
||||
if(menus!=null)
|
||||
for(String menu:menus){
|
||||
sysRoleMenu.setMenuId(menu);
|
||||
roleMenuService.insert(sysRoleMenu);
|
||||
|
@ -134,8 +138,8 @@ public class RoleController extends BaseController {
|
|||
return jsonUtil;
|
||||
}
|
||||
|
||||
/* @ApiOperation(value = "/del", httpMethod = "POST", notes = "删除角色")
|
||||
@Log(desc = "删除角色")*/
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除角色")
|
||||
@Log(desc = "删除角色",type = LOG_TYPE.DEL)
|
||||
@PostMapping(value = "del")
|
||||
@ResponseBody
|
||||
public String del(String id) {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class UserController extends BaseController{
|
|||
return "/system/user/userList";
|
||||
}
|
||||
|
||||
@GetMapping(value = "showUserList", produces = "text/json;charset=UTF-8")
|
||||
@GetMapping(value = "showUserList")
|
||||
@ResponseBody
|
||||
public String showUser(Model model, SysUser user, String page, String limit) {
|
||||
// logger.error("show userList");
|
||||
|
@ -144,10 +144,11 @@ public class UserController extends BaseController{
|
|||
for(SysRoleUser sysRoleUser1 :keyList){
|
||||
roleUserService.deleteByPrimaryKey(sysRoleUser1);
|
||||
}
|
||||
|
||||
for(String r:role){
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insert(sysRoleUser);
|
||||
if(role!=null){
|
||||
for(String r:role){
|
||||
sysRoleUser.setRoleId(r);
|
||||
roleUserService.insert(sysRoleUser);
|
||||
}
|
||||
}
|
||||
jsonUtil.setFlag(true);
|
||||
jsonUtil.setMsg("修改成功");
|
||||
|
@ -157,8 +158,9 @@ public class UserController extends BaseController{
|
|||
return jsonUtil;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除用户")
|
||||
@PostMapping(value = "del")
|
||||
@Log(desc = "删除用户",type = LOG_TYPE.DEL)
|
||||
@ApiOperation(value = "/del", httpMethod = "POST", notes = "删除用户")
|
||||
@PostMapping(value = "/del")
|
||||
@ResponseBody
|
||||
public String del(String id, boolean flag) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
|
@ -220,6 +222,7 @@ public class UserController extends BaseController{
|
|||
}
|
||||
if(newPwd.equals(user.getPassword())){
|
||||
j.setMsg("新密码不能与旧密码相同");
|
||||
|
||||
return j;
|
||||
}
|
||||
user.setPassword(newPwd);
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
|
|
|
@ -32,6 +32,7 @@ public class RoleServiceImpl extends BaseServiceImpl<SysRole,String> implements
|
|||
|
||||
@Override
|
||||
public int insert(SysRole record) {
|
||||
record=super.addValue(record,true);
|
||||
return roleMapper.insert(record);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
</div>
|
||||
<div class="layui-col-md12" style="height:40px;margin-top:3px;">
|
||||
<div class="layui-btn-group">
|
||||
<shiro.hasPermission name="user:select">
|
||||
<shiro.hasPermission name="control:del">
|
||||
<button class="layui-btn layui-btn-normal" data-type="del">
|
||||
<i class="layui-icon"></i>删除
|
||||
</button>
|
||||
|
@ -71,7 +71,9 @@
|
|||
|
||||
<table id="logList" class="layui-hide" lay-filter="log"></table>
|
||||
<script type="text/html" id="toolBar">
|
||||
<shiro.hasPermission name="control:del">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i>删除</a>
|
||||
</shiro.hasPermission>
|
||||
</script>
|
||||
<script>
|
||||
layui.laytpl.toDateString = function(d, format){
|
||||
|
|
|
@ -211,15 +211,15 @@ To change this template use File | Settings | File Templates.-->
|
|||
type:'post',
|
||||
data:data.field,
|
||||
async:false, dataType: "json", traditional: true,
|
||||
success:function(msg){
|
||||
success:function(data){
|
||||
console.info(data.msg);
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
window.top.layer.msg(data.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
parent.layer.close(index);
|
||||
//window.parent.layui.table.reload('userList');
|
||||
window.top.layer.msg(msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
},error:function(){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
window.top.layer.msg('请求失败',{icon:5,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
parent.layer.close(index);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
<body>
|
||||
<div class="x-nav">
|
||||
<div class="layui-btn-group">
|
||||
<shiro.hasPermission name="nemu:add">
|
||||
<button class="layui-btn layui-btn-normal" data-type="add">
|
||||
<i class="layui-icon"></i>新增
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-sm" id="refresh" style="float: right;" onclick="javascript:location.replace(location.href);">
|
||||
<i class="layui-icon">ဂ</i>
|
||||
|
|
|
@ -35,13 +35,8 @@ To change this template use File | Settings | File Templates.-->
|
|||
}
|
||||
};
|
||||
var zNodes =${menus};
|
||||
|
||||
/* function setCheck() {
|
||||
var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
|
||||
}*/
|
||||
$(document).ready(function(){
|
||||
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
|
||||
// setCheck();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
@ -141,7 +136,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
url:'addRole',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false,dataType: "json", traditional: true,
|
||||
async:false, traditional: true,
|
||||
success:function(msg){
|
||||
console.info('msg:'+msg);
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
|
|
|
@ -62,22 +62,34 @@
|
|||
</div>
|
||||
<div class="layui-col-md12" style="height:40px;margin-top:3px;">
|
||||
<div class="layui-btn-group">
|
||||
<shiro.hasPermission name="role:add">
|
||||
<button class="layui-btn layui-btn-normal" data-type="add">
|
||||
<i class="layui-icon"></i>新增
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="role:update">
|
||||
<button class="layui-btn layui-btn-normal" data-type="update">
|
||||
<i class="layui-icon"></i>编辑
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="role:select">
|
||||
<button class="layui-btn layui-btn-normal" data-type="detail">
|
||||
<i class="layui-icon"></i>查看
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
</div>
|
||||
</div>
|
||||
<table id="roleList" class="layui-hide" lay-filter="user"></table>
|
||||
<script type="text/html" id="toolBar">
|
||||
<shiro.hasPermission name="role:add">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="role:update">
|
||||
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">编辑</a>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="role:del">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
</shiro.hasPermission>
|
||||
</script>
|
||||
<script>
|
||||
layui.laytpl.toDateString = function(d, format){
|
||||
|
@ -216,9 +228,8 @@
|
|||
url: "del",
|
||||
type: "post",
|
||||
data: {id: id},
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
layer.msg(msg, {icon: 6});
|
||||
layer.msg(msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
layui.table.reload('roleList');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -38,7 +38,6 @@ To change this template use File | Settings | File Templates.-->
|
|||
var zNodes =${menus};
|
||||
$(document).ready(function(){
|
||||
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
|
||||
// setCheck();
|
||||
});
|
||||
|
||||
|
||||
|
@ -158,7 +157,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
url:'updateRole',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false,dataType: "json", traditional: true,
|
||||
async:false, traditional: true,
|
||||
success:function(d){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
|
|
|
@ -249,7 +249,7 @@ To change this template use File | Settings | File Templates.-->
|
|||
url:'addUser',
|
||||
type:'post',
|
||||
data:data.field,
|
||||
async:false, dataType: "json", traditional: true,
|
||||
async:false,traditional: true,
|
||||
success:function(msg){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.layer.close(index);
|
||||
|
|
|
@ -252,7 +252,6 @@ To change this template use File | Settings | File Templates.-->
|
|||
type:'post',
|
||||
data:data.field,
|
||||
async:false,
|
||||
dataType: "json",
|
||||
traditional: true,
|
||||
success:function(d){
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
|
|
|
@ -67,19 +67,21 @@
|
|||
<i class="layui-icon"></i>新增
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="user:update">
|
||||
<shiro.hasPermission name="user:select">
|
||||
<button class="layui-btn layui-btn-normal" data-type="update">
|
||||
<i class="layui-icon"></i>编辑
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="user:del">
|
||||
<button class="layui-btn layui-btn-normal" data-type="detail">
|
||||
<i class="layui-icon"></i>查看
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="user:repass">
|
||||
<button class="layui-btn layui-btn-normal" data-type="changePwd">
|
||||
<i class="layui-icon"></i>修改密码
|
||||
</button>
|
||||
</shiro.hasPermission>
|
||||
</div>
|
||||
</div>
|
||||
<table id="userList" class="layui-hide" lay-filter="user"></table>
|
||||
|
@ -87,9 +89,9 @@
|
|||
<shiro.hasPermission name="user:select">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
</shiro.hasPermission>
|
||||
<#--<@shiro.hasPermission name="user:update">-->
|
||||
<shiro.hasPermission name="user:update">
|
||||
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">编辑</a>
|
||||
<#--</@shiro.hasPermission>-->
|
||||
</shiro.hasPermission>
|
||||
<shiro.hasPermission name="user:del">
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
</shiro.hasPermission>
|
||||
|
@ -244,13 +246,14 @@
|
|||
}
|
||||
function del(id, flag) {
|
||||
$.ajax({
|
||||
url: "del",
|
||||
type: "post",
|
||||
data: {id: id, flag: flag},
|
||||
dataType: "json",
|
||||
success: function (msg) {
|
||||
layer.msg(msg, {icon: 6});
|
||||
url:"del",
|
||||
type:"post",
|
||||
data:{id:id,flag:flag},async:false,
|
||||
success:function(msg){
|
||||
window.top.layer.msg(msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
|
||||
layui.table.reload('userList');
|
||||
},error:function(){
|
||||
alert('error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -98,6 +98,8 @@
|
|||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-ehcache:1.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-aspectj:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||
|
|
|
@ -20,7 +20,7 @@ public class FreeMarkerConfig {
|
|||
@Bean
|
||||
public ViewResolver viewResolver() {
|
||||
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
|
||||
resolver.setCache(true);
|
||||
resolver.setCache(false);
|
||||
resolver.setViewClass(org.springframework.web.servlet.view.freemarker.FreeMarkerView.class);
|
||||
resolver.setRequestContextAttribute("re");
|
||||
resolver.setExposeSpringMacroHelpers(true);
|
||||
|
@ -42,7 +42,7 @@ public class FreeMarkerConfig {
|
|||
configuration.setClassicCompatible(true);
|
||||
result.setConfiguration(configuration);
|
||||
Properties settings = new Properties();
|
||||
settings.put("template_update_delay", 0);
|
||||
settings.put("template_update_delay", "0");
|
||||
settings.put("default_encoding", "UTF-8");
|
||||
settings.put("number_format", "0.##########");
|
||||
settings.put("datetime_format", "yyyy-MM-dd HH:mm:ss");
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.len.config;
|
||||
|
||||
import com.len.core.annotation.LogAspect;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/3.
|
||||
* @email 154040976@qq.com
|
||||
*/
|
||||
@Configuration
|
||||
public class LogConfig {
|
||||
|
||||
@Bean(name = "logAspect")
|
||||
public LogAspect getLogAspect(){
|
||||
return new LogAspect();
|
||||
}
|
||||
|
||||
}
|
|
@ -58,6 +58,14 @@ public class ShiroConfig {
|
|||
return new LifecycleBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator(){
|
||||
getLifecycleBeanPostProcessor();
|
||||
DefaultAdvisorAutoProxyCreator dc=new DefaultAdvisorAutoProxyCreator();
|
||||
dc.setProxyTargetClass(true);
|
||||
return dc;
|
||||
}
|
||||
|
||||
@Bean(name="securityManager")
|
||||
public DefaultWebSecurityManager getDefaultWebSecurityManager(){
|
||||
DefaultWebSecurityManager dwm=new DefaultWebSecurityManager();
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
package com.len.config;
|
||||
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
import com.len.core.annotation.LogAspect;
|
||||
import com.len.freemarker.MyFreemarkerConfig;
|
||||
import freemarker.template.TemplateException;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.ui.freemarker.FreeMarkerConfigurationFactory;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
|
@ -23,15 +34,21 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
|||
@Configuration
|
||||
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
|
||||
@Bean
|
||||
public HttpMessageConverter<String> responseBodyConverter() {
|
||||
StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
|
||||
return converter;
|
||||
}
|
||||
@Override
|
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
super.configureMessageConverters(converters);
|
||||
converters.add(responseBodyConverter());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/plugin/**")
|
||||
.addResourceLocations("classpath:/plugin/");
|
||||
}
|
||||
|
||||
@Bean(name = "logAspect")
|
||||
public LogAspect getLogAspect(){
|
||||
return new LogAspect();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ logging:
|
|||
|
||||
spring:
|
||||
freemarker:
|
||||
cache: false
|
||||
template-loader-path: classpath:/ftl/
|
||||
|
||||
datasource:
|
||||
|
@ -29,6 +30,9 @@ spring:
|
|||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxOpenPreparedStatements: 20
|
||||
http:
|
||||
encoding:
|
||||
force: true
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@
|
|||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sf.ehcache:ehcache-core:2.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-ehcache:1.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-aspectj:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||
|
|
8
pom.xml
8
pom.xml
|
@ -121,6 +121,14 @@
|
|||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-aspectj -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-aspectj</artifactId>
|
||||
<version>1.4.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
Loading…
Reference in New Issue