accessing base class methods in SpEL

1.6k views Asked by At

My class structure is as below:

package com.xyz.abc.controller;

public class Roles {
   public Static String REQ_ROLE = "LEARNER";
}

public class BaseController {
   protected String getRole() { return something; }
}

public class AccountController extends BaseController {
   @Cacheable(value="mycache", key="#accountId", condition="#root.target.getRole() == Roles.REQ_ROLE")
   public String getAccount(final @PathVariable String accountId) { return account; }
}

I am trying to call a base class function in condition of Cacheable using SpEL. However this throws an error saying :

Method call: Method getRole() cannot be found on com.xyz.abc.controller.AccountController type

How do i call the super method from this context?

1

There are 1 answers

2
Gary Russell On

The method is not visible. Make it public.