mirror of
https://github.com/ctripcorp/zeus.git
synced 2024-09-22 00:26:05 +08:00
return null instead of DalNotFoundException
This commit is contained in:
parent
e931cacafd
commit
293e62c524
|
@ -0,0 +1,28 @@
|
|||
package com.ctrip.zeus.service.aop;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.unidal.dal.jdbc.DalNotFoundException;
|
||||
|
||||
/**
|
||||
* Created by zhoumy on 2015/4/3.
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class DalNotFoundAspect {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Around("execution(* com.ctrip.zeus..*Dao.*(..))")
|
||||
public Object allowNullValue(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
try {
|
||||
return joinPoint.proceed();
|
||||
} catch (DalNotFoundException ex) {
|
||||
logger.info("Caught DalNotFoundException, return null instead.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
<context:component-scan base-package="com.ctrip.zeus"/>
|
||||
<aop:aspectj-autoproxy/>
|
||||
<!-- use cglib -->
|
||||
<aop:aspectj-autoproxy proxy-target-class="true"/>
|
||||
|
||||
<import resource="dao-beans.xml"/>
|
||||
</beans>
|
||||
|
|
Loading…
Reference in a new issue