Announcement Announcement Module
Collapse
No announcement yet.
General use sample classes not available in core/infrastructure artifacts Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • General use sample classes not available in core/infrastructure artifacts

    I have been prototyping some work with spring batch, and we have decided to move forward with the technology.

    There are some classes that I pulled out of the sample projects, that seem to have some general use, but are not available in any of the main artifacts (such as core or infrastructure)

    For Example StepExecutionApplicationEventAdvice, SimpleMessageApplicationEvent, DataSourceInitializer, and LogAdvice.

    These were all classes developed for the samples project, but could be used as is by many projects. If you search the spring-batch fisheye repository, several of these classes are duplicated multiple times in the code base because they are so useful, but it is not practical to depend on a samples project to pull real production classes.

    Could these classes be reviewed and moved into sb-infrastructure, or core to enable them to be used as general purpose classes?

  • #2
    DatasourceInitializer is part of spring 3 (or at least that has that functionality). There are different LogAdvice (debug,trace, performance) in the core spring project so no need to duplicate those...

    The others I don't know but the SimpleMessageApplicationEvent I have my doubts about that one... But that is just IMHO .

    Comment


    • #3
      I had a feeling that those classes had to exist somewhere. If they are in core spring, (or spring-jdbc, etc.) Then I would request that the samples project change to use the pre-packaged classes.

      As for the jmx advice classes, they could probably be in their own module. I can see usefulness to have steps published to jmx without having to write my own class that looks just like the one in the sample project.

      Comment


      • #4
        For anyone interested, I migrated my code from using a copy of DataSourceInitializer from the spring-batch-samples project, to using the one that comes packaged with Spring 3.

        Old configuration:
        Code:
        <bean id="dataSourceInitializer" class="org.oclc.sb.DataSourceInitializer">
                <property name="dataSource" ref="dataSource"/>
                <property name="initialize" value="${batch.data.source.init}"/>
                <property name="initScripts">
                    <list>
                        <value>${batch.drop.script}</value>
                        <value>${batch.schema.script}</value>
                    </list>
                </property>
            </bean>
        New Configuration:
        Code:
        <bean id="dataSourceInitializer" class="org.springframework.jdbc.datasource.init.DataSourceInitializer">
                <property name="dataSource" ref="dataSource"/>
                <property name="enabled" value="${batch.data.source.init}"/>
                <property name="databasePopulator">
                    <bean class="org.springframework.jdbc.datasource.init.ResourceDatabasePopulator">
                        <property name="scripts">
                            <list>
                                <value>${batch.drop.script}</value>
                                <value>${batch.schema.script}</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>

        Comment

        Working...
        X