com.young.license.client.advice.LicenseAdvice.java Source code

Java tutorial

Introduction

Here is the source code for com.young.license.client.advice.LicenseAdvice.java

Source

package com.young.license.client.advice;

import com.young.license.client.config.Config;
import com.young.license.client.tools.LicenseTool;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.web.servlet.ModelAndView;

//@Aspect
//@Component("licenseAdvice")
public class LicenseAdvice {

    // @Around("execution(* org.bdp.modules.*.*.controller..*.*(..))")
    public Object checkLicense(ProceedingJoinPoint pj) throws Throwable {
        /**
         * ?license,?proceed,??
         */
        if (!LicenseTool.verify()) {
            System.out.println("License is expired ....redirect to [" + "redirect:" + Config.getExpirePage() + "]");
            return new ModelAndView("redirect:" + Config.getExpirePage());
        }
        return pj.proceed();
    }
}