Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call the bean with the separator in the name to flow

I have a bean

<bean name="api.HelloWorld" class="ru.example.api.HelloWorld"/>

When you call in flow I get an error.

<evaluate expression="api.HelloWorld.test()"/>

How to call?

like image 931
user5809756 Avatar asked Jan 31 '26 11:01

user5809756


1 Answers

If you are using SpEL, you can use this:

<evaluate expression="@'api.HelloWorld'.test()"/>

if you are using OGNL or jboss-el, I don't think it can be done other than using a utility class, like this:

@Component
public class WebFlowUtil {

    @Autowired
    private ApplicationContext applicationContext;

    public Object getBean(String beanName) {
        return applicationContext.getBean(beanName);
    }
}

then use:

<evaluate expression="webFlowUtil.getBean('api.HelloWorld').test()"/>
like image 92
rptmat57 Avatar answered Feb 03 '26 01:02

rptmat57