在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java  網(wǎng)絡安全/ spring配置aop后,struts2的請求全部失效了,請問這是什么原因?

spring配置aop后,struts2的請求全部失效了,請問這是什么原因?

spring配置

    <!-- ##########################aop start########################## -->
    <!-- 啟用AOP -->  
    <aop:aspectj-autoproxy />
    <!-- aop日志記錄方法 -->
    <bean id="sysLogAspect" class="com.otw.common.aspect.SysLogAspect"/>
    <!-- 配置AOP -->
    <aop:config>
        <!-- 配置切點表達式  -->
        <aop:pointcut id="sysLogPointcut" expression="execution(* com.otw.web.action.*.*(..))" />
        <!-- 配置切面及配置 -->
        <aop:aspect ref="sysLogAspect">     
            <!-- 環(huán)繞增強 -->
            <aop:around method="around" pointcut-ref="sysLogPointcut" />
        </aop:aspect>
    </aop:config>
    <!-- ##########################aop end########################## -->
/*
 * 描述:
 * 修改人:17109
 * 修改時間:2018年3月13日
 */

package com.otw.common.aspect;


import java.lang.reflect.Method;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.SecurityUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;

import com.google.gson.Gson;
import com.otw.common.annotation.SysLogAnnotation;
import com.otw.utils.HttpContextUtils;
import com.otw.utils.IPUtils;
import com.otw.web.pojo.SysLog;
import com.otw.web.pojo.SysLogin;
import com.otw.web.service.SysLogService;


@Aspect
public class SysLogAspect
{
    @Autowired
    private SysLogService sysLogService;

    @Pointcut("@annotation(com.otw.common.annotation.SysLogAnnotation)")
    public void logPointCut()
    {

    }

    @Around("logPointCut()")
    public Object around(ProceedingJoinPoint point)
        throws Throwable
    {
        long beginTime = System.currentTimeMillis();
        // 執(zhí)行方法
        Object result = point.proceed();
        // 執(zhí)行時長(毫秒)
        long time = System.currentTimeMillis() - beginTime;

        // 保存日志
        saveSysLog(point, time);

        return result;
    }

    private void saveSysLog(ProceedingJoinPoint joinPoint, long time)
    {
        MethodSignature signature = (MethodSignature)joinPoint.getSignature();
        Method method = signature.getMethod();

        SysLog sysLog = new SysLog();
        SysLogAnnotation sysLogAnnotation = method.getAnnotation(SysLogAnnotation.class);
        if (sysLogAnnotation != null)
        {
            // 注解上的描述
            sysLog.setOperation(sysLogAnnotation.value());
        }

        // 請求的方法名
        String className = joinPoint.getTarget().getClass().getName();
        String methodName = signature.getName();
        sysLog.setMethod(className + "." + methodName + "()");

        // 請求的參數(shù)
        Object[] args = joinPoint.getArgs();
        try
        {
            String params = new Gson().toJson(args[0]);
            sysLog.setParams(params);
        }
        catch (Exception e)
        {

        }

        // 獲取request
        HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
        // 設置IP地址
        sysLog.setIp(IPUtils.getIpAddr(request));

        // 用戶名
        String username = ((SysLogin)SecurityUtils.getSubject().getPrincipal()).getName();
        sysLog.setUsername(username);

        sysLog.setTime(time);
        sysLog.setCreateDate(new Date());
        // 保存系統(tǒng)日志
        sysLogService.insert(sysLog);
    }
}
/**
 * 系統(tǒng)日志注解
 *
 * @author linyuting
 * @since 2018-3-13
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SysLogAnnotation {

    String value() default "";
}
回答
編輯回答
撥弦

你把com.otw.common.annotation.SysLogAnnotation這個文件貼出來看一下

2017年9月24日 02:45