封装一个controller,写了一些基础接口。然后新建子类controller继承父controller,发现子类写的接口能正常使用,但请求父controller那些封装的接口,就会404。是不是jfinal4.1的路由不会映射父controller的接口?
子类controller:
public class AreaController extends BaseActionController<Area> { private static AreaService service = ZhidanContext.getBean(AreaService.class); @Override protected AreaService getService() { return service; } public void location() { AreaInfoVo infoVo = service.location(); renderSuccessResult(infoVo); } }
父类controller:
public abstract class BaseActionController<T extends Model<T>> extends BaseReadActionController<T> { private static final Logger log = Logger.getLogger(BaseActionController.class); public BaseActionController() { } protected abstract ServiceBase<T> getService(); private T getDao() { return this.getService().getDao(); } @Before({Tx.class}) public void save() { try { T bean = this.getBean(); this.beforeSave(bean); this.getService().save(bean); log.info("=== save model successfully.======"); this.afterSave(bean); this.renderSuccessResult(bean); } catch (Exception var2) { var2.printStackTrace(); this.renderFailedResult("Failed to save, exception is :" + var2.getMessage()); log.warn("=== failed to saveOrUpdate ======"); } } ......
项目:JFinal