Results 1 to 2 of 2

Thread: Using ExecutionContext to dynamically set bean property

  1. #1
    Join Date
    Mar 2011
    Posts
    9

    Default Using ExecutionContext to dynamically set bean property

    I just started to use spring batch and pretty new at this and I need help. What I'm trying to do is to use ExecutionContext to dynamically set the properties (sql query) in the bean. Something like following:

    Code:
     <bean id="chunkReader" class="org.springframework.batch.item.database.JdbcCursorItemReader">
    	<property name="sql" value="#{executionContext[sqlName]}" />
    </bean>
    The sql query and other bean properties will be pulled from the database

    Is it possible?
    If so where would I declare this ExecutionContext and populate it?

    If not is there other way to set this dynamically on the runtime without using the .properties file?

    Thanks

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    If the sql query string is in backend storage somewhere you can just write a service that pulls it out and refer to it in your bean property value (e.g. #{queryService.sql}). This doesn't look like a Spring Batch requirement, so maybe I'm missing something?

Posting Permissions

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