Try the below code. Make sure you have the R6 annotations dependencies in the pom.
import com.day.cq.workflow.WorkflowException;
import com.day.cq.workflow.WorkflowSession;
import com.day.cq.workflow.exec.ParticipantStepChooser;
import com.day.cq.workflow.exec.WorkItem;
import com.day.cq.workflow.metadata.MetaDataMap;
import org.osgi.service.component.annotations.Component;
@Component(service = ParticipantStepChooser.class, property = {"chooser.label = A Test Particpant Chooser step"})
public class DynamicParticipantStepChooser implements ParticipantStepChooser {
@Override
public String getParticipant(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
// code
return "administrators";
}
}