通过CGLIB实现AOP动态切换数据源,代理失败

[code="java"]
public class DatasourceBeforeAdvice implements MethodBeforeAdvice{

@Override
public void before(Method method, Object[] args, Object target)
        throws Throwable {
    // TODO Auto-generated method stub
    String serverCode = (String)args[0];
    for(CustomerType ct : CustomerType.values()){
        if(ct.toString().equals(serverCode)){
            CustomerContextHolder.setCustomerType(ct);
            break;
        }
    }
}

}
[/code]
[code="java"]






dsBeforeAdvice



[/code]
结果没有进入advice,代理失败,请教一下原因。

没有指定target
void setTarget(Object target)
Set the given object as target.

1、targetClass:Set a target class to be proxied, indicating that the proxy should be castable to the given class. (指定代理的类的类型 会把目标对象转成该类型进行代理)