spring - Putting into the jobExecutionContext - UnsupportedOperationException -


i have following step defined in spring batch project. i've simplified code brevity.

@bean @jobscope public jdbccursoritemreader<masterlist> querystagingdbreader(         @value("#{jobexecutioncontext['" + executioncontextconstants.job_export_staging_promotion_start_date_end_date_groupings +"']}")         list<promotionstartdateenddategrouping> promotionstartdateenddategroupings,         @value("#{jobexecutioncontext}")map<string, object> jobexecutioncontext) {        jobexecutioncontext.put(executioncontextconstants.job_export_staging_working_promotion_start_date_end_date, "hello");  } 

my problem when try add jobexecutioncontext per put statment above ...

caused by: java.lang.unsupportedoperationexception: null     @ java.util.collections$unmodifiablemap.put(collections.java:1457) ~ 

if not work how can add jobexecutioncontext?

thanks in advance

what receiving there not actual executioncontext. it's map values within executioncontext. obtain actual executioncontext, you'd need grab jobexecution itself. being said, in cases, stepscope more appropriate or native singleton.


Comments