我有一个带有 Wicket 的 Spring 项目。我可以使用@SpringBean 注解成功地在 Wicket 组件中注入服务。
现在,我想访问 Spring Application Context。所以我声明了一个ApplicationContext类型的成员变量并用@SpringBean注解它,就像其他服务一样:
尝试使用@SpringBean 注入应用程序
public class MyPanel extends Panel {
@SpringBean
private ApplicationContext applicationContext;
...
}
但是,在运行时,这会给出错误
bean of type [org.springframework.context.ApplicationContext] not found
不能将 ApplicationContext 注入到 Wicket 组件中吗?如果是这样,什么是访问 ApplicationContext 的合适方法?