将建议应用于ManagedBean类中的方法私有类

时间:2014-02-16 12:04:07

标签: java spring spring-aop

public class DoOperationManagedBean
{
    private PrivateHelper privateHelper;

    public DoOperationManagedBean() {
        privateHelper = new PrivateHelper();
    }

    //Currently @Around is applied on the is method.
    public void perform(List<SomeClass> list){
        for(SomeClass sc: list) {
            privateHelper.execute(sc);
        }
    }

    private class PrivateHelper{
        //want to apply @Around on this method
        public void execute(SomeClass sc){
            //Code to process sc. 
        }
    }

}

我可以对Around方法应用DoOperationManagedBean.perform建议,因为DoOperationManagedBean是Spring Managed Bean。

我需要将Around建议应用于PrivateHelper.execute方法。但由于我无法在private之外实例化DoOperationManagedBean类,因此我无法将其设为托管bean。

有没有办法在advice上申请PrivateHelper.execute

0 个答案:

没有答案