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
    }
}
reos
  • 8,766
  • 6
  • 28
  • 34
chabapok
  • 921
  • 1
  • 8
  • 14

1 Answers1

1

You can do this:

beans {
    myCoolBean(Foo)
    myCoolBeanCall(myCoolBean: 'func', 'a', 5)
}