ActiveMQ
  1. ActiveMQ
  2. AMQ-2702

Localize Spring-related classes in a separate module

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.1
    • Fix Version/s: 5.9.0
    • Component/s: None
    • Labels:
      None

      Description

      We should try reducing Spring dependency on the broker core (and other modules) and move all Spring-related classes in a separate module.

      1. AMQ-2702.diff
        1 kB
        Gert Vanthienen

        Activity

        Dejan Bosanac created issue -
        Hide
        Dejan Bosanac added a comment -

        rev 935952 introduced activemq-spring module and moved a few classes there. Incidentally activemq-pool module doesn't have spring dependency any more.

        The main question is what should we do with all tests in activemq-core (and other modules), that depends on Spring (and preventing us to do a better separation). IMHO we should move them either in this newly-created activemq-spring module or activemq-all module or even previously created sys test project. It will require some refactoring and probably make debugging a bit harder, but I think it's the move we have to make.

        Show
        Dejan Bosanac added a comment - rev 935952 introduced activemq-spring module and moved a few classes there. Incidentally activemq-pool module doesn't have spring dependency any more. The main question is what should we do with all tests in activemq-core (and other modules), that depends on Spring (and preventing us to do a better separation). IMHO we should move them either in this newly-created activemq-spring module or activemq-all module or even previously created sys test project. It will require some refactoring and probably make debugging a bit harder, but I think it's the move we have to make.
        Hide
        Gary Tully added a comment -

        For a start I guess the spring-module can have any of the FactoryBeans and we can revert core to use annotations where there are spring dependencies in the class hierarchy so that core can injection container agnostic.

        All of the spring config could move long term to system tests, it may be possible to do an alternative config mechanism and reuse the tests in some way.

        Show
        Gary Tully added a comment - For a start I guess the spring-module can have any of the FactoryBeans and we can revert core to use annotations where there are spring dependencies in the class hierarchy so that core can injection container agnostic. All of the spring config could move long term to system tests, it may be possible to do an alternative config mechanism and reuse the tests in some way.
        Hide
        Gert Vanthienen added a comment -

        Now that this class is in the separate activemq-spring module, would it be possible to reintroduce the InitializingBean and DisposableBean interfaces on the PooledConnectionFactoryBean (cfr. AMQ-2702.diff) so it can be used in a plain Spring context without requiring the use of <context:annotation-driven/> to init/destroy the bean?

        Show
        Gert Vanthienen added a comment - Now that this class is in the separate activemq-spring module, would it be possible to reintroduce the InitializingBean and DisposableBean interfaces on the PooledConnectionFactoryBean (cfr. AMQ-2702 .diff) so it can be used in a plain Spring context without requiring the use of <context:annotation-driven/> to init/destroy the bean?
        Gert Vanthienen made changes -
        Field Original Value New Value
        Attachment AMQ-2702.diff [ 19370 ]
        Rob Davies made changes -
        Fix Version/s 5.4.1 [ 12332 ]
        Hide
        Dejan Bosanac added a comment -

        With svn revision 965820, we don't have runtime dependency on Spring. XBeanBrokerService doesn't implement ApplicationContextAware and we introduced BrokerContext which should be used to make bean lookups container neutral. Currently there's only SpringBrokerContext implementation that uses ApplicationContext to lookup for the beans. Similar classes can be implemented for other environments, like Blueprint for example.

        To enable usage of broker context in Spring environment, you should use something like

        <bean id="springContext" class="org.apache.activemq.spring.SpringBrokerContext" />
        
        <broker brokerContext="#springContext">
        
          ... 
        
        </broker>
        
        
        Show
        Dejan Bosanac added a comment - With svn revision 965820, we don't have runtime dependency on Spring. XBeanBrokerService doesn't implement ApplicationContextAware and we introduced BrokerContext which should be used to make bean lookups container neutral. Currently there's only SpringBrokerContext implementation that uses ApplicationContext to lookup for the beans. Similar classes can be implemented for other environments, like Blueprint for example. To enable usage of broker context in Spring environment, you should use something like <bean id= "springContext" class= "org.apache.activemq.spring.SpringBrokerContext" /> <broker brokerContext= "#springContext" > ... </broker>
        Bruce Snyder made changes -
        Fix Version/s 5.5.0 [ 12344 ]
        Fix Version/s 5.4.1 [ 12332 ]
        Jeff Turner made changes -
        Project Import Fri Nov 26 22:32:02 EST 2010 [ 1290828722158 ]
        Dejan Bosanac made changes -
        Fix Version/s 5.5.0 [ 12315626 ]
        Fix Version/s 5.4.2 [ 12315625 ]
        Gary Tully made changes -
        Fix Version/s 5.6.0 [ 12316331 ]
        Fix Version/s 5.5.0 [ 12315626 ]
        Timothy Bish made changes -
        Fix Version/s 5.8.0 [ 12323282 ]
        Fix Version/s 5.x [ 12316331 ]
        Hide
        Timothy Bish added a comment -

        This one looks to now be complete for v5.8 ?

        Show
        Timothy Bish added a comment - This one looks to now be complete for v5.8 ?
        Timothy Bish made changes -
        Assignee Dejan Bosanac [ dejanb ]
        Gary Tully made changes -
        Fix Version/s 5.9.0 [ 12323932 ]
        Fix Version/s 5.8.0 [ 12323282 ]
        Timothy Bish made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1182d 3h 58m 1 Timothy Bish 15/Jul/13 20:02

          People

          • Assignee:
            Dejan Bosanac
            Reporter:
            Dejan Bosanac
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development