Announcement Announcement Module
Collapse
No announcement yet.
script control over beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • script control over beans

    During the rebuilding of an old legacy system I found necessary to reuse some classes and porting them under the new spring based application. I wasn't willing to write a further java piece to wire them as the prior way, instead, I defined a groovy class that link them and process a simple flow as required:

    <bean id="idA" .. <bean id="idB ... and so on, then

    Code:
    <lang:groovy id="mix" init-method="go"  autowire="byName"> 
     <lang:inline-script>
     class Mix{
      def idA
      def idB
      void go(){
       idA.addObserver(idB)
       idA.startPinging()
       idA.registerBean(.....
      };
     </lang:inline-script>
    </lang:groovy>
    The approach works fine but enforce me to define a grovvy class (Mix), an initial method, like a normal java class. I'm wondering whether you may find it useful and worthy the implemention of a feature that aims to wiring classes as the example:

    Code:
    <lang:groovy> 
     <lang:inline-script>
       idA.addObserver(idB)
       idA.startPinging()
       idA.registerBean(.....
     </lang:inline-script>
    </lang:groovy>
    or inside the 'bean' definition as follows:

    Code:
    <bean id="idA" ....>
      .......
     <lang:groovy> 
      addObserver(idB)
      startPinging()
     </lang:groovy>
    </bean>
    I agree that the explanation and the proposal isn't detailed, but I'd like to hear about your opinion about that.
Working...
X