I have a problem with beans in mule 4. There is an error when trying to invoke java:
Element 'springService' is not defined in the Mule Registry
Error occures in run time.
I have created configuration.xml and declared spring config:
<spring:config name="springConfig" doc:name="springConfig" files="beans.xml" />
Then created beans.xml in /src/main/resources:
<beans ...>
<context:component-scan base-package="com.services" />
</beans>
com.services is an external service that has a class:
@Service
public class SpringService {
...
}
EDIT1: The way I am trying to invoke java method:
<java:invoke doc:name="Get data" doc:id="id" class="com.services.SpringService" method="#[getData(String)]" instance="springService">
<java:args><![CDATA[#[{name: vars.name}]]]></java:args>
</java:invoke>
Stack trace:
Message : Element 'springService' is not defined in the Mule Registry
Element : test-flow/processors/2 @ test-service:test.xml:14 (Get Data)
Element DSL : <java:invoke doc:name="Get data" doc:id="id" class="com.services.SpringService" method="#[getData(String)]" instance="springService"> java:args#[{name: vars.name}]</java:args> </java:invoke> Error type : MULE:UNKNOWN
FlowStack : at test-flow(test-flow/processors/2 @ test-service:test.xml:14 (Get Data)) at get:\getData(name):test-api-config(get:\getData(name):test-api-config/processors/0 @ test-service:test-api.xml:125 (Get Data)) at test-api-main(test-api-main/processors/0 @ test-service:test-api.xml:15)