parent
79eced21e7
commit
2ee63efef7
@ -1,17 +1,28 @@ |
|||||||
package org.pqh.core.aop; |
package org.pqh.core.aop; |
||||||
|
|
||||||
|
import org.aopalliance.aop.Advice; |
||||||
import org.pqh.core.dao.BaseDao; |
import org.pqh.core.dao.BaseDao; |
||||||
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor; |
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.PostConstruct; |
||||||
|
import javax.annotation.Resource; |
||||||
import java.lang.reflect.Method; |
import java.lang.reflect.Method; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by reborn on 2017/8/3. |
* Created by reborn on 2017/8/3. |
||||||
*/ |
*/ |
||||||
|
@Component |
||||||
public class InsertAdvisor extends StaticMethodMatcherPointcutAdvisor { |
public class InsertAdvisor extends StaticMethodMatcherPointcutAdvisor { |
||||||
|
@Resource |
||||||
|
private Advice insertAdvice; |
||||||
@Override |
@Override |
||||||
public boolean matches(Method method, Class<?> aClass) { |
public boolean matches(Method method, Class<?> aClass) { |
||||||
return method.getName().equals("get")&& BaseDao.class.isAssignableFrom(aClass); |
return BaseDao.class.isAssignableFrom(aClass); |
||||||
} |
} |
||||||
|
|
||||||
|
@PostConstruct |
||||||
|
public void init(){ |
||||||
|
this.setAdvice(insertAdvice); |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -1,12 +0,0 @@ |
|||||||
package org.pqh.core.aop; |
|
||||||
|
|
||||||
import org.aspectj.lang.annotation.Pointcut; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by reborn on 2017/8/3. |
|
||||||
*/ |
|
||||||
public class MatcherRule { |
|
||||||
@Pointcut("execution(* org.pqh.core.dao.BaseDao.*(..))") |
|
||||||
public void biliDaoRule() { |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,11 @@ |
|||||||
|
package org.pqh.core.util; |
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager; |
||||||
|
import org.apache.logging.log4j.Logger; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by reborn on 2017/9/19. |
||||||
|
*/ |
||||||
|
public interface LogManger { |
||||||
|
Logger log=LogManager.getLogger(); |
||||||
|
} |
Loading…
Reference in new issue