Java配置文件Java配置文件
扫描注解
上传文件
引入其他xml文件
加载初始化***.properties
classpath*:geiss/resource/jdbc/jdbc.properties
classpath*:gei...
Java配置文件
扫描注解
上传文件
引入其他xml文件
加载初始化***.properties
classpath*:geiss/resource/jdbc/jdbc.properties
classpath*:geiss/resource/hibernate/hibernate.propertie
s
数据库配置信息
,,,,,,,
如果配置信息读取的是***.properties初始化文件 格式文件名.键名比如配置,,,,,,,工厂的取值
配置session工厂
${hibernate.dialect}
${hibernate.hbm2ddl.auto}
true
true
${hibernate.query.substitutions}
${hibernate.default_batch_fetch_size}
${hibernate.max_fetch_depth}
${hibernate.generate_statistics}
${hibernate.bytecode.use_reflection_optimizer}
${hibernate.cache.use_second_level_cache}
${hibernate.cache.use_query_cache}
${hibernate.cache.regi
on.factory_class}
${net.sf.ehcache.c
onfigurationResourceName}
${hibernate.cache.us
e_structured_entries}
数据源的局部事物管理器
hibernate事务相关
,,,,,,,声明事物
开启AOP监听
注册自定义的处理器拦截器
配置静态文件
mapping="/images/**"/>
收到相应请求后直接选择相应的视图
,,,.XML
, 初始化过程:
1. 在启动Web项目时,容器(比如Tomcat)会读web.xml配置文件中的两个节点
和。
2. 接着容器会创建一个ServletContext(上下文),应用范围内即整个WEB项目都能
使用这个上下文。
3. 接着容器会将读取到转化为键值对,并交给ServletContext。
4. 容器创建中的类实例,即创建监听(备注:listener定义的
类可以是自定义的类但必须需要继承ServletContextListener)。
5. 在监听的类中会有一个contextInitialized(ServletContextEvent event)初始化方
法,在这个方法中可以通过
event.getServletContext().getInitParameter("contextConfigLocation") 来得到
context-param 设定的值。在这个类中还必须有一个
contextDestroyed(ServletContextEvent event) 销毁方法.用于关闭应用前释放
资源,比如说数据库连接的关闭。
6. 得到这个context-param的值之后,你就可以做一些操作了.注意,这个时候你的
WEB项目还没有完全启动完成.这个动作会比所有的Servlet都要早。
由上面的初始化过程可知容器对于web.xml的加载过程是context-param >>
listener >> fileter >> servlet
设置编码
encodingFilter
org.springframework.web.filter.CharacterEncoding
Filter
encoding
UTF-8
forceEncoding
true
encodingFilter
/*
创建上下文
contextConfigLocation
classpath:applicationContext-controller.xml,
classpath:applicationContext-dsone.xml,
classpath:applicationContext-job.xml,
classpath:applicationContext-ws.xml
创建监听
org.springframework.web.context.ContextLoaderList
ener
配置,,,,,,,,,的DispatcherServlet
spring-mvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:applicationContext-controller.xml
1
spring-mvc
/
本文档为【Java配置文件】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。