<?xml version="1.0" encoding="UTF-8"?> <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" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <!-- 启动对@Aspectj注解的支持--> <aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 使Spring关注Annotation --> <context:annotation-config/> <!-- 让Spring通过自动扫描来查询和管理Bean --> <context:component-scan base-package="com.xxx" /> <!-- 配置的计划任务 --> <bean id="everydayTaskJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="TimedTaskService" /> <property name="targetMethod" value="delLogTask" /> <property name="concurrent" value="false" /> </bean> <bean id="myTaskTrigger" class="com.xxx.InitializingCronTrigger"> <property name="jobDetail" ref="everydayTaskJob" /> <property name="deleteLogTime" value=""></property> </bean> <!-- Scheduler的配置 --> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="myTaskTrigger" /> </list> </property> <property name="autoStartup" value="true" /> <property name="quartzProperties"> <props> <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop> </props> </property> </bean> <!-- 配置SessionFactory,由Spring容器来管理Hibernate --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value>classpath:hibernate.cfg.xml</value> </property> </bean> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory" /> </property> </bean> <!-- 启用注解方式的事务配置 --> <tx:annotation-driven transaction-manager="transactionManager"/> <!-- cache manager --> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <property name="shared" value="true"/> <property name="configLocation" value="classpath:ehcache.xml"/> </bean> <bean id="ehCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> <property name="cacheManager" ref="cacheManager"/> <property name="cacheName" value="root"/> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" default-lazy-init="false"> <description>Spring公共配置 </description> <!-- 定时器配置 --> <task:executor id="executor" pool-size="5" /> <task:scheduler id="scheduler" pool-size="10" /> <!-- 定义受环境影响易变的变量 --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="order" value="1" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <property name="ignoreResourceNotFound" value="true" /> <property name="locations"> <list> <!-- 标准配置 --> <value>classpath*:/application.properties</value> <value>classpath*:/comm-config.properties</value> </list> </property> </bean> <!-- 使用annotation 自动注册控制器层,service层,dao层的bean,并保证@Required,@Autowired的属性被注入 --> <context:component-scan base-package="com.mall" /> <!-- 数据源配置,使用应用内的DBCP数据库连接池 --> <!-- <bean id="dataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"> <property name="targetDataSource"> <ref local="mainDataSource" /> </property> </bean> <bean id="mainDataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"> <property name="driverClass" value="${jdbc.driver}" /> <property name="jdbcUrl" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="idleConnectionTestPeriod" value="60" /> <property name="idleMaxAge" value="240" /> <property name="maxConnectionsPerPartition" value="30" /> <property name="minConnectionsPerPartition" value="1" /> <property name="partitionCount" value="4" /> <property name="acquireIncrement" value="2" /> <property name="poolAvailabilityThreshold" value="20"/> <property name="releaseHelperThreads" value="3" /> </bean> --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="1" /> <property name="minIdle" value="2" /> <property name="maxIdle" value="2" /> <property name="maxActive" value="50" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="60000" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="60000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="300000" /> <property name="validationQuery" value="SELECT 1 from dual" /> <property name="testWhileIdle" value="true" /> <property name="testOnBorrow" value="false" /> <property name="testOnReturn" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 --> <property name="poolPreparedStatements" value="true" /> <property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> <!-- 配置监控统计拦截的filters --> <property name="filters" value="stat" /> </bean> <!-- 数据源配置,使用应用服务器的数据库连接池 --> <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor" /> <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" lazy-init="true"> <property name="nativeJdbcExtractor"> <ref local="nativeJdbcExtractor" /> </property> </bean> <!-- Hibernate配置 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="namingStrategy"> <bean class="org.hibernate.cfg.DefaultNamingStrategy" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> <prop key="hibernate.max_fetch_depth">1</prop> <prop key="hibernate.jdbc.batch_size">50</prop> <prop key="hibernate.jdbc.batch_versioned_data">true</prop> <prop key="hibernate.jdbc.fetch_size">100</prop> <!-- <prop key="hibernate.hbm2ddl.auto">update</prop> --> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">trues</prop> <prop key="hibernate.cache.region_prefix">cache</prop> <prop key="hibernate.cache.provider_class">com.googlecode.hibernate.memcached.MemcachedCacheProvider</prop> <prop key="hibernate.memcached.servers">172.16.80.102:11211</prop> <prop key="hibernate.memcached.memcacheClientFactory">net.rubyeye.xmemcached.utils.hibernate.XmemcachedClientFactory</prop> <prop key="hibernate.memcached.keyStrategy">com.googlecode.hibernate.memcached.Md5KeyStrategy</prop> <prop key="hibernate.memcached.cacheTimeSeconds">3600</prop> <prop key="hibernate.memcached.commandFactory">BinaryCommandFactory</prop> <prop key="hibernate.memcached.hashAlgorithm">KETAMA_HASH</prop> <prop key="hiberante.memcached.sessionLocator">KetamaMemcachedSessionLocator</prop> </props> </property> <property name="mappingDirectoryLocations"> <list> <value>classpath:com/model</value> <value>classpath:com/model</value> </list> </property> <property name="packagesToScan" value="com.model,com.**.entity" /> <property name="lobHandler"> <ref bean="oracleLobHandler" /> </property> </bean> <!-- 事务管理器配置,单数据源事务 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> <property name="nestedTransactionAllowed" value="true"/> </bean> <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <property name="corePoolSize" value="2"/> <property name="keepAliveSeconds" value="200"/> <property name="maxPoolSize" value="10"/> <property name="queueCapacity" value="10000" /> </bean> <!-- 使用annotation定义事务 --> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="false" /> <task:annotation-driven/> <!-- SpyMemcached客户端 --> <bean id="spyMemcachedClient" class="org.springside.modules.memcached.SpyMemcachedClient"> <!-- 设置Memcached集群 --> <!-- <property name="memcachedNodes" value="11211,192.168.1.17:11211,192.168.1.30:11211,192.168.1.31:11211,192.168.1.35:11211" /> --> <property name="memcachedNodes" value="${memcached.url}" /> <!-- 缩短Timeout时间到200毫秒 --> <property name="operationTimeout" value="5000" /> </bean> </beans>
下面是web.xml的示例:
示例1:
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/applicationContext.xml</param-value> </context-param> <!-- <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </filter-class> </filter> --> <!-- <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> </filter> --> <filter> <filter-name>struts-prepare</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class> </filter> <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class> </filter> <filter> <filter-name>struts-execute</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class> </filter> <filter> <filter-name>encodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <!-- <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> --> <!-- <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> --> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts-prepare</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts-execute</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <servlet> <servlet-name>sitemesh-freemarker</servlet-name> <servlet-class>org.apache.struts2.sitemesh.FreemarkerDecoratorServlet</servlet-class> <init-param> <param-name>default_encoding</param-name> <param-value>UTF-8</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>sitemesh-freemarker</servlet-name> <url-pattern>*.ftl</url-pattern> </servlet-mapping> <servlet> <servlet-name>dwr-invoker</servlet-name> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>allowScriptTagRemoting</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <listener> <listener-class> org.apache.struts2.dispatcher.ng.listener.StrutsListener </listener-class> </listener> </web-app>
示例2:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/beans.xml</param-value> </context-param> <!-- <context-param> <param-name>jwebap-config</param-name> <param-value>/WEB-INF/conf/jwebap.xml</param-value> </context-param> --> <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/go/*</url-pattern> </filter-mapping> <!-- Disable sessionid <filter> <filter-name>DisableUrlSessionFilter</filter-name> <filter-class> com.comm.web.util.DisableUrlSessionFilter </filter-class> </filter> <filter-mapping> <filter-name>DisableUrlSessionFilter</filter-name> <url-pattern>/vvshopIndex.jhtml</url-pattern> <url-pattern>/vvshopHomepage.jhtml</url-pattern> </filter-mapping> --> <servlet> <servlet-name>freemarker</servlet-name> <servlet-class> com.opensymphony.webwork.views.freemarker.FreemarkerServlet </servlet-class> </servlet> <servlet> <servlet-name>ValidateCode</servlet-name> <servlet-class>com.comm.web.util.ValidateCode</servlet-class> </servlet> <servlet> <servlet-name>JspSupportServlet</servlet-name> <servlet-class> com.opensymphony.webwork.views.JspSupportServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>CreateBarCode</servlet-name> <servlet-class>com.comm.web.util.BarCodeServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CreateBarCode</servlet-name> <url-pattern>/servlet/CreateBarCode</url-pattern> </servlet-mapping> <servlet> <servlet-name>CreateBarCodes</servlet-name> <servlet-class>com.comm.web.util.BarCodesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CreateBarCodes</servlet-name> <url-pattern>/servlet/CreateBarCodes</url-pattern> </servlet-mapping> <!-- <servlet> <servlet-name>initservlet</servlet-name> <servlet-class>com.luceneexa.exa.InitServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> --> <servlet> <servlet-name>dwr-invoker</servlet-name> <display-name>DWR Servlet</display-name> <description>Direct Web Remoter Servlet</description> <servlet-class> org.directwebremoting.servlet.DwrServlet </servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>pollAndCometEnabled</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>exposeInternals</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>allowGetForSafariButMakeForgeryEasier</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>activeReverseAjaxEnabled</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>crossDomainSessionSecurity</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>allowScriptTagRemoting</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- <servlet> <servlet-name>detect</servlet-name> <servlet-class>org.jwebap.ui.controler.JwebapServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>detect</servlet-name> <url-pattern>/detect/*</url-pattern> </servlet-mapping> --> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name> <url-pattern>*.dwr</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>freemarker</servlet-name> <url-pattern>*.shtml</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ValidateCode</servlet-name> <url-pattern>/code.bmp</url-pattern> </servlet-mapping> <servlet> <servlet-name>DruidStatView</servlet-name> <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>DruidStatView</servlet-name> <url-pattern>/druid/*</url-pattern> </servlet-mapping> <filter> <filter-name>ActionContextCleanUp</filter-name> <filter-class> com.opensymphony.webwork.dispatcher.ActionContextCleanUp </filter-class> </filter> <filter> <filter-name>sitemesh</filter-name> <filter-class> com.comm.web.util.FixedFreeMarkerPageFilter </filter-class> </filter> <filter> <filter-name>webwork</filter-name> <filter-class> com.opensymphony.webwork.dispatcher.FilterDispatcher </filter-class> </filter> <!--<filter> <filter-name>urlFilter</filter-name> <filter-class>com.comm.web.util.UrlFilter</filter-class> </filter>--> <!-- <filter> <filter-name>userloginfilter</filter-name> <filter-class>com.comm.web.util.UserLoginFilter</filter-class> </filter> <filter-mapping> <filter-name>userloginfilter</filter-name> <url-pattern>/go/admins/*</url-pattern> </filter-mapping>--> <filter> <filter-name>CacheFilter</filter-name> <filter-class> com.opensymphony.oscache.web.filter.CacheFilter </filter-class> <init-param> <param-name>time</param-name> <param-value>600</param-value> </init-param> <init-param> <param-name>scope</param-name> <param-value>application</param-value> </init-param> </filter> <!-- <filter> <filter-name>PageDetectFilter</filter-name> <filter-class>org.jwebap.plugin.tracer.http.DetectFilter</filter-class> <init-param> <param-name>excludeUrls</param-name> <param-value>/detect;/detect/*;*.js;*.jpg;*.htm;*.html;*.gif;*.png;*.css;*.swf</param-value> </init-param> <init-param> <param-name>charset</param-name> <param-value>GBK</param-value> </init-param> </filter> --> <filter-mapping> <filter-name>CacheFilter</filter-name> <url-pattern>/listTList/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>CacheFilter</filter-name> <url-pattern>/seachPicList/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>CacheFilter</filter-name> <url-pattern>/showTagPicList/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>CacheFilter</filter-name> <url-pattern>/adminshowTagPicList/*</url-pattern> </filter-mapping> <!-- <filter-mapping> <filter-name>CacheFilter</filter-name> <url-pattern>/vvshopChannelSelect/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>CacheFilter</filter-name> <url-pattern>/vvshopIndex.jhtml</url-pattern> </filter-mapping>--> <filter-mapping> <filter-name>ActionContextCleanUp</filter-name> <url-pattern>*.jhtml</url-pattern> </filter-mapping> <filter-mapping> <filter-name>ActionContextCleanUp</filter-name> <url-pattern>/application/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/go/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/n/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>*.jhtml</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/application/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <servlet-name>freemarker</servlet-name> </filter-mapping> <filter-mapping> <filter-name>webwork</filter-name> <url-pattern>/go/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>webwork</filter-name> <url-pattern>/n/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>webwork</filter-name> <url-pattern>*.jhtml</url-pattern> </filter-mapping> <filter-mapping> <filter-name>webwork</filter-name> <url-pattern>*.xml</url-pattern> </filter-mapping> <filter-mapping> <filter-name>webwork</filter-name> <url-pattern>/application/*</url-pattern> </filter-mapping> <!-- <filter-mapping> <filter-name>urlFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>--> <!-- <filter-mapping> <filter-name>PageDetectFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> --> <session-config> <session-timeout>30</session-timeout> </session-config> <!-- <listener> <listener-class>org.jwebap.startup.JwebapListener</listener-class> </listener> --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.util.IntrospectorCleanupListener </listener-class> </listener> <welcome-file-list> <welcome-file>demo.html</welcome-file> </welcome-file-list> <!-- <error-page> <error-code>404</error-code> <location>/errors/404.shtml</location> </error-page> <error-page> <error-code>400</error-code> <location>/errors/400.shtml</location> </error-page> <error-page> <error-code>500</error-code> <location>/errors/500.shtml</location> </error-page>--> <taglib> <taglib-uri>webwork</taglib-uri> <taglib-location>/WEB-INF/webwork.tld</taglib-location> </taglib> <taglib> <taglib-uri>tiyi</taglib-uri> <taglib-location>/WEB-INF/tiyi.tld</taglib-location> </taglib> <listener> <listener-class>com.comm.web.util.MySessionListener</listener-class> </listener> </web-app>
相关推荐
使用myeclipse8.5搭建SSH后,将struts.xml和applicationContext.xml移动到别的地方,示例中为webroot下的config文件夹中,web.xml中需要做的修改示例。其中对于返回上一层方式不同的myeclipse可能不同,如有的用../...
org.springframework.web.context.ContextLoaderListener ``` 这段代码指定了一个Listener类`ContextLoaderListener`,该类由Spring框架提供,用于在应用程序启动时加载Spring的上下文配置。 #### Filter ...
这个压缩包“spring3.0 + Quartz1.52 + applicationContext.xml”显然是一个关于如何在Spring 3.0环境中集成Quartz 1.52版本的示例或教程资源。 首先,`applicationContext.xml`是Spring框架的核心配置文件,它定义...
- **加载Spring配置文件**:这主要是通过`org.springframework.web.context.ContextLoaderListener`类实现的。该类是Spring框架提供的一个监听器类,用于在Web应用启动时加载Spring的应用上下文(ApplicationContext...
其中,`applicationContext.xml`是Spring框架的核心配置文件之一,它用于管理应用上下文中的各种Bean以及它们之间的依赖关系。本文将详细介绍`applicationContext.xml`文件的结构、各个元素的作用以及如何正确配置。...
在Spring框架中,`applicationContext.xml`是应用上下文的核心配置文件,用于定义bean的创建、依赖关系以及各种服务的配置。这篇博文“Spring 2.5 - applicationContext.xml提示信息的配置”主要探讨了如何在Spring ...
在Spring框架中,`applicationContext.xml`是配置文件的主入口,用于定义bean的创建、依赖关系以及各种服务的提供。当我们谈论`applicationContext-dao.xml`时,我们主要关注的是数据访问对象(DAO)层的配置。 `...
通过`@ImportResource`、自定义`ApplicationContextInitializer`以及`BeanDefinitionReader`,我们可以灵活地读取并加载不同路径下的`applicationContext.xml`文件,实现与现有XML配置的无缝集成。
例如,对于Spring框架而言,通常会将Spring的配置文件(如applicationContext.xml)放在WEB-INF目录下,以增强安全性;而对于一些如log4j的配置文件log4j.properties,可能放置在类路径下更为方便。 综上所述,web....
<listener-class>org.springframework.web.context.ContextLoaderListener ``` 这个代码段告诉Spring框架,我们想要使用ContextLoaderListener来读取上下文配置文件。 contextConfigLocation ...
Spring ISofttone可能是这个压缩包中包含的一个示例项目,它可能演示了如何在Spring应用中使用`applicationContext.xml`配置灵活性代理,包括IoC容器的bean定义、AOP的使用以及事务管理等。通过分析和学习这个项目,...
3. **在`web.xml`中配置Hibernate**:在`WEB-INF/web.xml`中,我们需要添加一个初始化参数,指向`hibernate.cfg.xml`的位置。这样,当Tomcat启动时,可以通过这个参数加载Hibernate配置。例如: ```xml <web-app> ...
在`applicationContext.xml`文件中,定义DataSource,这是连接到数据库的关键。配置包括数据库驱动类、URL、用户名和密码。例如: ```xml <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">...
<listener-class>org.springframework.web.context.ContextLoaderListener <!-- 配置编码过滤器 --> <filter-name>Spring character encoding filter <filter-class>org.springframework.web.filter....
- 工程结构图未给出,但通常包括以下几个部分:源代码目录(src/main/java)、资源目录(src/main/resources)、Web内容目录(src/main/webapp)、配置文件(如web.xml、struts.xml、applicationContext.xml等)。...
而Servlet 3.0是Java Servlet API的一个重要版本,引入了许多新特性,使得我们不再依赖传统的web.xml部署描述符,能够进行更加灵活的配置。本文将深入探讨如何在Servlet 3.0环境下,结合Spring MVC实现无web.xml配置...
IoC是一种设计模式,它将对象之间的依赖关系从代码中解耦出来,转交给一个外部容器(在Spring中就是ApplicationContext)来管理。通过这种方式,对象不再需要自己创建或查找依赖的对象,而是由容器负责实例化、装配...
b 编写实体类,加入hibernate注解,编写方法类测试类,在applicationContext.xml中添加hibernate模板类配置以及包扫描语句 。在类中添加spring bean注解。 c 测试类中 主动解析applicationContext.xml ,获取bean ...