Results 1 to 4 of 4

Thread: General use sample classes not available in core/infrastructure artifacts

  1. #1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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 .
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    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.

  4. #4

    Default

    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •