2

How to invoke method from spring configuration groovy-based file? I know about MethodInvokingFactoryBean, but i want more simple way.

My bean:

public class Foo{
    public void func(String prm1, int prm2){
       System.out.println("Func called with "+prm1+","+prm2);
    }
}

My beans.groovy:

beans {
    myCoolBean(Foo){
        //how to invoke func method?
        func('a', 5) //not working
    }
}
4

1 回答 1

1

你可以这样做:

beans {
    myCoolBean(Foo)
    myCoolBeanCall(myCoolBean: 'func', 'a', 5)
}
于 2018-07-10T05:16:00.507 回答