Unable to read Application.properties when invoked from Java Delegate

I am facing exactly same issue as the below thread … comment below are incorporated but cannot fix my issue

TIA

Are you able to Autowire other services in your java delegate?
Confirm that you can autowire another service in the delegate and use that service. (you cannot just autowire, as it can autowire to a null object and not throw a error)

@StephenOTT : u are right on… Autowiring to another service is wiring to a null object.

What am I missing here ?

So did you follow the specifics outlined in your Originally linked post?

When you are calling your java delegate you are doing so with the implementation “delegate expedition” ? And have a expression such as “myCustomDelegate”, where you class/@Component was called MyCustomDelegate ?

package com.hips.configuration;

@Component(“Sample”)
public class Sample implements JavaDelegate{

@Value("${spring.datasource.password}")
private	String pp;

@Autowired
TestService ts;


public String refreshUsersOnDemand() {
	System.out.println("refreshUsersOnDemand ===  "+pp);
	System.out.println("password "+pp);
	return pp;
}


@Override
public void execute(DelegateExecution execution) throws Exception {
	this.refreshUsersOnDemand();
            ts.printDate();
}

====================================================================

Uploaded the code and snap-shot.
Basically anything coming in via an Http / rest call , I can retrieve the values from properties file but when attempting the same via Camunda Tasklist :: Start Process : Java Delegate implementation doesn’t.

@StephenOTT - in my case slight difference is that its not an expression, rather Java Class … would that not be possible ?
Just noticed I have the mapping to the Delegate from the Listener section… but I get the same result from the General tab :frowning:

@ppbiz you missed this post in the original thread:

<serviceTask id="beanService"
             name="My Bean Service Task"
             camunda:delegateExpression="${myDelegateBean}" />

You need to set your Listener Type / implementation to delegate expression

1 Like

@StephenOTT - Yep … That was it… it works with Delegate Expression but I would think it should work as a Java class also …? and was it working in earlier versions of Camunda and deprecated now?
My current version
Spring-Boot: (v2.1.1.RELEASE)
Camunda BPM: (v7.10.0-ee)
Camunda BPM Spring Boot Starter: (v3.2.0)

Not sure. But should be like this for a while: Impacts of not using Delegate Expression for SpringBoot Java Delegate Resolution needs to be highlighted more clearly in docs!?

If you find a previous version that it works with, would be happy to hear it.

Remember it still “works” with just java class, it’s just does not actually have the auto wiring. So possible you just missed it

1 Like