在我的“区域”春季应用中,我有这一方法将春季管理人员引入<>代码>WebApplication类别:
private void initManager() {
ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
this.manager = (MyManager) applicationContext.getBean("manager");
}
我通常在<代码>in
public class MyApplication extends WebApplication {
@Override
protected void init() {
IApplicationSettings applicationSettings = getApplicationSettings();
applicationSettings.setInternalErrorPage(ErrorPage.class);
mountBookmarkablePage("privacy", PrivacyPage.class);
}
//............
}
My WebPage
classes usually depend on my manager class, for instance:
public class ErrorPage extends WebPage {
public ErrorPage() {
MyApplication application = (MyApplication) getApplication();
add(new EmailLink(application.getManager().getMailSupport()));
}
}
因此,我的<代码>WebApplication类别系指一个或多个网页,我的网页指的是WebApplication
。 这是一种循环依赖吗? 如果是,我如何能够避免?