Spring常见面试题总结
2017-08-31 18:19
453 查看
1、Spring里面applicationContext.xml文件能不能改成其他文件名?
ContextLoaderListener是一个ServletContextListener, 它在你的web应用启动的时候初始化。缺省情况下, 它会在WEB-INF/applicationContext.xml文件找Spring的配置。 你可以通过定义一个<context-param>元素名字为”contextConfigLocation”来改变Spring配置文件的 位置。示例如下:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/xyz.xml</param-value>
</context-param>
</listener-class>
</listener>
2、spring中的BeanFactory与ApplicationContext的作用有哪些?
1. BeanFactory负责读取bean配置文档,管理bean的加载,实例化,维护bean之间的依赖关系,负责bean的声明周期。
2. ApplicationContext除了提供上述BeanFactory所能提供的功能之外,还提供了更完整的框架功能:
a. 国际化支持
b. 资源访问:Resource rs = ctx. getResource(”classpath:config.properties”), “file:c:/config.properties”
c. 事件传递:通过实现ApplicationContextAware接口
3、什么是aop,aop的作用是什么?
ContextLoaderListener是一个ServletContextListener, 它在你的web应用启动的时候初始化。缺省情况下, 它会在WEB-INF/applicationContext.xml文件找Spring的配置。 你可以通过定义一个<context-param>元素名字为”contextConfigLocation”来改变Spring配置文件的 位置。示例如下:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/xyz.xml</param-value>
</context-param>
</listener-class>
</listener>
2、spring中的BeanFactory与ApplicationContext的作用有哪些?
1. BeanFactory负责读取bean配置文档,管理bean的加载,实例化,维护bean之间的依赖关系,负责bean的声明周期。
2. ApplicationContext除了提供上述BeanFactory所能提供的功能之外,还提供了更完整的框架功能:
a. 国际化支持
b. 资源访问:Resource rs = ctx. getResource(”classpath:config.properties”), “file:c:/config.properties”
c. 事件传递:通过实现ApplicationContextAware接口
3、什么是aop,aop的作用是什么?
相关文章推荐
- 机器学习常见的算法面试题总结
- 【操作系统】--常见面试题总结
- 常见面试题总结
- Quartz + spring 定时任务常见错误总结
- 数据库常见面试题总结
- Sql常用语句 and Sql常见面试题(总结)
- C++常见面试题总结
- 【面试】【Spring常见问题总结】【01】
- Spring Cloud中,Eureka常见问题总结
- 计算机网络常见面试题总结——2
- spring常见面试题
- C++常见面试题总结(1)
- 操作系统常见面试题总结
- php面试题常见知识点总结
- 总结积累 java常见面试题及答案
- 操作系统常见面试题总结
- 操作系统常见面试题总结
- java常见面试题总结
- spring常见的面试题
- spring面试题个人总结