@OutboundConnector(
name = “MYCONNECTOR”,
inputVariables = {
“entityName”},
type = “io.camunda:my-connector:1”)
public class MyConnectorFunction implements OutboundConnectorFunction {
@Value("${some.text.var}")
private String someTextVar;
@Override
public Object execute(OutboundConnectorContext context) {
try {
final var connectorRequest = context.bindVariables(MyConnectorRequest.class);
return "Hello, World: " + someTextVar;
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
}
I created a JSON template for it, connected it to Camunda Modeler, built and deployed the JAR of this connector in Docker using docker-compose in the connectors image.
I also added an application.properties file to my connector project and defined a property there:
some.text.var=Some Test Var1
As you can see from the code above, I am trying to access this property, but it is always null. Is there any mechanism to access Spring properties from a connector, or some way to view the Spring context?
Hey @Alex3, your connector would need to be on your component scanning path where Spring looks for components. You could then for example inject Springs Environment bean.
We have not tried this but in theory you could provide an environment variable to the Connector Runtime that includes your package in the component scan if Spring allows that.