Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope SPI support for EL binding [SPR-5224] #9898

Closed
spring-projects-issues opened this issue Oct 21, 2008 · 1 comment
Closed

Scope SPI support for EL binding [SPR-5224] #9898

spring-projects-issues opened this issue Oct 21, 2008 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Dave Syer opened SPR-5224 and commented

Need to have late binding to scope-specific attributes in Spring Batch, e.g.

<bean class="..." scope="step">
<property name="resource" value="#{stepAttributes.inputFile}"/>
</bean>

or

<bean class="..." scope="step">
<property name="reader" ref="#{stepAttributes.readerRef}"/>
</bean>


Issue Links:

  • BATCH-282 Make input parameters easier to access from ItemReaders, etc. ("is depended on by")
@spring-projects-issues
Copy link
Collaborator Author

Dave Syer commented

Draft code from notes we made in September:

public class StepScope implements Scope {

public String[] getAttributeNames() {
	return new String[] { "stepAttributes", "jobParameters" };
}

public Object resolveAttribute(String name) {
	StepContext context = getContext();
	if ("stepAttributes".equals(name)) {
		// TODO: need to return this as a map / AttributeAccessor(?) to enable
		// map-like de-referencing in EL
		return context.getStepExecution().getExecutionContext();
	}
	else if ("jobParameters".equals(name)) {
		return context.getStepExecution().getJobParameters();
	}
	throw new IllegalStateException("Unknown variable name: [" + name + "]");
}

  ...

}

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 M1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants