Error in camunda springboot tutorial

Hi
I am following camunda springboot tutorial, in the following model, when i complete prepare for departure task , i get the following error :

Unknown property used in expression: #{reserveSeatOnBoat}. Cause: Cannot resolve identifier ‘reserveSeatOnBoat’

process.bpmn (6.4 KB)

Processing: ReserveSeatOnBoat.java…

package com.camunda.springboot;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;

public class ReserveSeatOnBoat implements JavaDelegate {

@Override
public void execute(DelegateExecution execution) throws Exception {
	// TODO Auto-generated method stub
	
	String money = "0.0";
    String ticketType = "Coach";

    money = (String) execution.getVariable("money");
    double moneyDouble = Double.parseDouble(money);

    if (moneyDouble >= 10000) {
        ticketType = "First Class";
    } else if (moneyDouble >= 5000) {
        ticketType = "Business Class";
    }

    execution.setVariable("ticketType", ticketType);

}

}

You must define ReserveSeatOnBoat as Spring bean. In this link in LoanApplicationContext class you can find bean definition of CalculateInterestService.

1 Like

I am using springboot project, the link that you mentioned is about spring framework.

Hi @mrdavoodi64,

Have you tried to annotate the JavaDelegate class ReserveSeatOnBoat as in below

@Service(“reserveSeatOnBoat”)

1 Like

Hi @hassang
Thanks so much. That works :slight_smile:

I don’t know what you said about spring boot in this context. But with the attached link you can define your JavaDelegate as Spring bean as same as Service annotation.

Hi @Mohammad_Mahdavi,

Spring boot application is used here so no spring application context class.
The link you are referring to is valid for spring application.

I missed that at the beginning and thought spring application is used.

Just as a side note - you can find the full solution on github if you want to compare what you’ve got in future.

2 Likes