0
基類的方法我的類結構如下:訪問在規劃環境地政司
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; }
}
我想打電話給使用規劃環境地政司可緩存的條件的基類的功能。然而,這會拋出一個錯誤說:
Method call: Method getRole() cannot be found on com.xyz.abc.controller.AccountController type
如何從這種情況下調用超級方法?
沒有。它力求有所作爲。我在BaseController中公開了getRole(),但我仍然得到相同的錯誤。 – mns
我有同樣的問題,使父方法公共工程對我來說。 – smartwjw