Skip to content

Unable to define a scripted bean as an inner bean of another bean [SPR-8036] #12691

Closed
@spring-projects-issues

Description

@spring-projects-issues

David Launen opened SPR-8036 and commented

Currently using BeanShell, however I would assume that this would be the same issue for other scripting languages as they all appear to use the same method of construction.

All examples I have found show scripted beans being defined as an identified bean, I have not found any examples that use a scripted bean as an inner bean. When attempting to define a scripted bean as an inner bean, a bean not found exception is thrown. Workaround of course is to define the scripted bean as a standalone identified bean, however this is not ideal.

The following XML definition example will result in a bean not found exception for the inner bean "lang:bsh XXXXX":

<beans>
<property name="transition" >
<bean class="com.test.workflow.transition.SimpleTransition">
<property name="strategy">
<lang:bsh script-interfaces="com.test.workflow.transition.election.ElectionStrategy">
<lang:inline-script>
<![CDATA[
public boolean evaluate(session, task, transitionEntry) {
return task.linked.claim.settlements.size < 1;
}
]]>
</lang:inline-script>
</lang:bsh>
</property>
</bean>
</property>
</beans>


Affects: 2.5.6

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions