比如我有一个filter,继承OncePerRequestFilter或者直接实现http filter
然后我通过下面的方式可以获取到定义在applicationContext.xml中的bean
WebApplicationContext web = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
SystemFacade systemFacade = (SystemFacade)web.getBean("systemFacade");但是实际的情况是SystemFacade是一个注解方式配置的,而不是xml方式配置的。有什么方法可以获取到注解方式定义的bean吗?
然后我通过下面的方式可以获取到定义在applicationContext.xml中的bean
WebApplicationContext web = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
SystemFacade systemFacade = (SystemFacade)web.getBean("systemFacade");但是实际的情况是SystemFacade是一个注解方式配置的,而不是xml方式配置的。有什么方法可以获取到注解方式定义的bean吗?
解决方案 »
- truezip问题求助
- 关于java适配器的问题
- 求一份Java网站设计的技术实现范文
- 我想点击个button然后弹出数据库中的一张表!
- 菜鸟请高手来指点下 非常感谢啊!!!!!
- +++一个java方法,包括了300个参数,编译时出错“too many parameter”,怎么办??
- 帮忙,HELP!
- 在xp下sql server2000和2005能同时安装吗?在xp下
- JDK1.4beta 64M大小,太大了,有没有几M的工具。
- 方法的调用问题,有一个可运行的例子,请进
- java编的程序在通知区域显示图标,不在任务栏上显示,就跟qq最小化后一样
- 想匹配2个文件A B的字符串,输出不同的行数。实现不了
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="beans" />
</beans>
你需要将base-package改成你自己Bean类所在的包。
我的主键现在都是正常。
我要解决的问题简单的说就是在filter内如何获取到使用annotation方式定义的bean