spring需要添加哪些配置文件以及如何配置
来源:互联网 发布:国产cad软件哪款好用 编辑:程序博客网 时间:2024/06/08 09:47
以项目中fwpj功能模块来说,编写该模块的功能时需要写action、service、dao层代码,写完之后需要给各层添加配置文件,这些配置文件就是为该层注入下一层的属性。
1、编写完action层代码之后,需要添加fwpj-action.xml文件,文件内容如下:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><bean class="com.thunisoft.susong51.fwpj.action.FwpjAction"> <property name="fwpjService" ref="fwpjService" /><property name="ajService" ref="ajService"></property><property name="layyService" ref="layyService" /></bean><bean class="com.thunisoft.susong51.fwpj.action.AjEvaluateAction"><property name="ajService" ref="ajService"></property><property name="ajpjService" ref="ajpjService"></property><property name="ajSsdlrService" ref="ajSsdlrService"></property><property name="dsrService" ref="dsrService"></property></bean></beans>
该配置文件就是为各action注入sercvice属性
2、编写完service层代码之后需要添加fwpj-service.xml文件
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><bean id="fwpjService"class="com.thunisoft.susong51.fwpj.service.impl.FwpjServiceImpl"><property name="fwpjDao" ref="fwpjDao"></property><property name="transactionTemplate" ref="transactionTemplate" /><property name="ajSsdlrService" ref="ajSsdlrService" /><property name="dsrService" ref="dsrService"></property><property name="proUserService" ref="proUserService" /><property name="ajService" ref="ajService"></property><property name="layyDao" ref="layyDao" /></bean><bean id="ajpjService"class="com.thunisoft.susong51.fwpj.service.impl.AjpjServiceImpl"><property name="ajpjDao" ref="ajpjDao"></property><property name="cacheService" ref="cacheService"></property><property name="zxAjDsrDao" ref="zxAjDsrDao"></property><property name="zxSsdlrDao" ref="zxSsdlrDao"></property><property name="fwpjDao" ref="fwpjDao"></property></bean></beans>该配置就是为service注入dao属性
3、dao层写完之后,添加fwpj-dao.xml文件
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><bean id="fwpjDao" class="com.thunisoft.susong51.fwpj.dao.impl.FwpjDaoImpl"><property name="sessionFactory" ref="sessionFactory" /><property name="jdbcTemplate" ref="jdbcTemplate" /></bean><bean id="ajpjDao" class="com.thunisoft.susong51.fwpj.dao.impl.AjpjDaoImpl"><property name="sessionFactory" ref="sessionFactory" /><property name="jdbcTemplate" ref="jdbcTemplate" /></bean></beans>4、由于一个项目中有多个模块,每个模块都有自己的dao、service、action配置文件所以需要将各模块的配置文件集中加载到统一的一个spring-dao、spring-service、spring-action中。
集中配置文件spring-action的写法如下:
<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd"> <!-- 以下 validator ConversionService 在使用 mvc:annotation-driven 会 自动注册 --> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"> <property name="providerClass" value="org.hibernate.validator.HibernateValidator" /> <!-- 如果不加默认到 使用classpath下的 ValidationMessages.properties --> <!-- <property name="validationMessageSource" ref="messageSource" /> --> </bean> <bean id="webBindingInitializer" class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer"> <property name="validator" ref="validator" /> </bean> <!-- 加上dispatcherServlet.properties中默认需要加载的3个HandlerAdapter --> <bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"></bean> <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"></bean> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="webBindingInitializer" ref="webBindingInitializer" /> </bean> <context:property-placeholder location="classpath*:config.properties" /> <bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="interceptors"> <list> <bean class="com.thunisoft.susong51.security.CommonHandlerInterceptor" /> </list> </property> </bean> <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></bean> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/" /> <property name="suffix" value=".jsp" /> </bean> <mvc:annotation-driven> <mvc:message-converters> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <constructor-arg value="UTF-8" /> <property name="supportedMediaTypes"> <list> <value>text/plain</value> <value>text/html</value> </list> </property> </bean> <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>applicaton/json</value> </list> </property> </bean> </mvc:message-converters> </mvc:annotation-driven> <import resource="classpath:com/thunisoft/susong51/ajcx/ajcx-action.xml" /> <import resource="classpath:com/thunisoft/susong51/layy/layy-action.xml" /> <import resource="classpath:com/thunisoft/susong51/dzsd/dzsd-action.xml" /> <import resource="classpath:com/thunisoft/susong51/platform/platform-action.xml" /> <import resource="classpath:com/thunisoft/susong51/xxfb/xxfb-action.xml" /> <import resource="classpath:com/thunisoft/susong51/cpws/cpws-action.xml" /> <import resource="classpath:com/thunisoft/susong51/mobile/mobile-action.xml" /> <import resource="classpath:com/thunisoft/susong51/fymh/fymh-action.xml" /> <import resource="classpath:com/thunisoft/susong51/news/news-action.xml" /> <import resource="classpath:com/thunisoft/susong51/ssfw/ssfw-action.xml" /> <import resource="classpath:com/thunisoft/susong51/splc/splc-action.xml" /> <import resource="classpath:com/thunisoft/susong51/fgxx/fgxx-action.xml" /> <import resource="classpath:com/thunisoft/susong51/zdal/zdal-action.xml" /> <import resource="classpath:com/thunisoft/susong51/zxxx/zxxx-action.xml" /> <import resource="classpath:com/thunisoft/susong51/mcxx/mcxx-action.xml" /> <import resource="classpath:com/thunisoft/susong51/video/vedio-action.xml" /> <import resource="classpath:com/thunisoft/susong51/tj/tj-action.xml" /> <import resource="classpath:com/thunisoft/susong51/search/search-action.xml" /> <import resource="classpath:com/thunisoft/susong51/feedback/feedback-action.xml" /> <import resource="classpath:com/thunisoft/susong51/infosupplement/supplement-action.xml" /> <import resource="classpath:com/thunisoft/susong51/fwpj/fwpj-action.xml" /> <import resource="classpath:com/thunisoft/susong51/yhzx/yhzx-action.xml" /> <import resource="classpath:com/thunisoft/susong51/home/home-action.xml" /> <import resource="classpath:com/thunisoft/susong51/wsyj/wsyj-action.xml" /> <import resource="classpath:com/thunisoft/susong51/yyjj/yyjj-action.xml" /> <import resource="classpath:com/thunisoft/susong51/yyts/yyts-action.xml" /> <import resource="classpath:com/thunisoft/susong51/payment/payment-action.xml" /><import resource="classpath:com/thunisoft/susong51/cyssxxtj/cyssxxtj-action.xml" /></beans>spring-service配置:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><import resource="classpath:com/thunisoft/susong51/ajcx/ajcx-service.xml" /><import resource="classpath:com/thunisoft/susong51/layy/layy-service.xml" /><import resource="classpath:com/thunisoft/susong51/dzsd/dzsd-service.xml" /><importresource="classpath:com/thunisoft/susong51/platform/platform-service.xml" /><import resource="classpath:com/thunisoft/susong51/xxfb/xxfb-service.xml" /><import resource="classpath:com/thunisoft/susong51/cpws/cpws-service.xml" /><import resource="classpath:com/thunisoft/susong51/tool/tool-service.xml" /><import resource="classpath:com/thunisoft/susong51/fymh/fymh-service.xml" /><import resource="classpath:com/thunisoft/susong51/news/news-service.xml" /><import resource="classpath:com/thunisoft/susong51/tj/tj-service.xml" /><import resource="classpath:com/thunisoft/susong51/search/search-service.xml" /><importresource="classpath:com/thunisoft/susong51/feedback/feedback-service.xml" /><import resource="classpath:com/thunisoft/susong51/fwpj/fwpj-service.xml" /><!-- 访问信息统计 --><import resource="classpath:com/thunisoft/susong51/tjweb/tjweb-service.xml" /><importresource="classpath:com/thunisoft/susong51/dzsd/dzsd-message-service.xml" /><import resource="classpath:com/thunisoft/susong51/sms/sms-service.xml" /><import resource="classpath:com/thunisoft/susong51/layy/job-service.xml" /><importresource="classpath:com/thunisoft/susong51/infosupplement/supplement-service.xml" /><import resource="classpath:com/thunisoft/susong51/splc/splc-service.xml" /><import resource="classpath:com/thunisoft/susong51/wsyj/wsyj-service.xml" /><import resource="classpath:com/thunisoft/susong51/yyjj/yyjj-service.xml" /><import resource="classpath:com/thunisoft/susong51/yyts/yyts-service.xml" /><import resource="classpath:com/thunisoft/susong51/zxxx/zxxx-service.xml" /><import resource="classpath:com/thunisoft/susong51/cyssxxtj/cyssxxtj-service.xml" /><!-- theme 主题 --><import resource="classpath:com/thunisoft/susong51/theme/theme-service.xml" /><import resource="classpath:com/thunisoft/susong51/home/home-service.xml" /><import resource="classpath:com/thunisoft/susong51/payment/payment-service.xml" /><import resource="classpath:com/thunisoft/susong51/yzt/yzt-service.xml" /><!-- timejob --><import resource="classpath:com/thunisoft/susong51/timejob/spring-job.xml" /><import resource="classpath:com/thunisoft/susong51/ssfw/ssfw-service.xml" /></beans>spring-dao配置:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><import resource="classpath:com/thunisoft/susong51/ajcx/ajcx-dao.xml" /><import resource="classpath:com/thunisoft/susong51/layy/layy-dao.xml" /><import resource="classpath:com/thunisoft/susong51/dzsd/dzsd-dao.xml" /><import resource="classpath:com/thunisoft/susong51/platform/platform-dao.xml" /><import resource="classpath:com/thunisoft/susong51/xxfb/xxfb-dao.xml" /><import resource="classpath:com/thunisoft/susong51/cpws/cpws-dao.xml" /><import resource="classpath:com/thunisoft/susong51/tool/tool-dao.xml" /><import resource="classpath:com/thunisoft/susong51/fymh/fymh-dao.xml" /><import resource="classpath:com/thunisoft/susong51/news/news-dao.xml" /><import resource="classpath:com/thunisoft/susong51/feedback/feedback-dao.xml" /><importresource="classpath:com/thunisoft/susong51/infosupplement/supplement-dao.xml" /><import resource="classpath:com/thunisoft/susong51/fwpj/fwpj-dao.xml" /><import resource="classpath:com/thunisoft/susong51/splc/splc-dao.xml" /><import resource="classpath:com/thunisoft/susong51/wsyj/wsyj-dao.xml" /><import resource="classpath:com/thunisoft/susong51/yyjj/yyjj-dao.xml" /><import resource="classpath:com/thunisoft/susong51/yyts/yyts-dao.xml" /><import resource="classpath:com/thunisoft/susong51/payment/payment-dao.xml" /><import resource="classpath:com/thunisoft/susong51/yzt/yzt-dao.xml" /><import resource="classpath:com/thunisoft/susong51/ssfw/ssfw-dao.xml" /><import resource="classpath:com/thunisoft/susong51/cyssxxtj/cyssxxtj-dao.xml" /></beans>
5、最后需要将集中的dao、action、service文件加载到applicationContext.xml文件中
<?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:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"xmlns:security="http://www.springframework.org/schema/security"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"><beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="locations"><list><value>classpath:config.properties</value></list></property><property name="ignoreUnresolvablePlaceholders" value="true" /></bean><bean id="messageSource"class="org.springframework.context.support.ReloadableResourceBundleMessageSource"><property name="basename" value="classpath:messages" /></bean><bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close"><property name="driverClassName"><value>${dataSource.driverClass}</value></property><property name="url"><value>${dataSource.jdbcUrl}</value></property><property name="username"><value>${dataSource.user}</value></property><property name="password"><value>${dataSource.password}</value></property><property name="maxActive"><value>${dbcp.maxActive}</value></property><property name="initialSize"><value>${dbcp.initialSize}</value></property><property name="maxWait"><value>${dbcp.maxWait}</value></property><property name="minIdle"><value>${dbcp.minIdle}</value></property><property name="timeBetweenEvictionRunsMillis"><value>${dbcp.timeBetweenEvictionRunsMillis}</value></property><property name="minEvictableIdleTimeMillis"><value>${dbcp.minEvictableIdleTimeMillis}</value></property><property name="validationQuery"><value>${dbcp.validationQuery}</value></property><property name="testWhileIdle"><value>${dbcp.testWhileIdle}</value></property><property name="testOnBorrow"><value>${dbcp.testOnBorrow}</value></property><property name="testOnReturn"><value>${dbcp.testOnReturn}</value></property><property name="poolPreparedStatements"><value>${dbcp.poolPreparedStatements}</value></property></bean><bean id="videoDataSource" class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close"><property name="driverClassName"><value>${videoDataSource.driverClass}</value></property><property name="url"><value>${videoDataSource.jdbcUrl}</value></property><property name="username"><value>${videoDataSource.user}</value></property><property name="password"><value>${videoDataSource.password}</value></property><property name="maxActive"><value>${dbcp.maxActive}</value></property><property name="initialSize"><value>${dbcp.initialSize}</value></property><property name="maxWait"><value>${dbcp.maxWait}</value></property><property name="minIdle"><value>${dbcp.minIdle}</value></property><property name="timeBetweenEvictionRunsMillis"><value>${dbcp.timeBetweenEvictionRunsMillis}</value></property><property name="minEvictableIdleTimeMillis"><value>${dbcp.minEvictableIdleTimeMillis}</value></property><property name="validationQuery"><value>${dbcp.validationQuery}</value></property><property name="testWhileIdle"><value>${dbcp.testWhileIdle}</value></property><property name="testOnBorrow"><value>${dbcp.testOnBorrow}</value></property><property name="testOnReturn"><value>${dbcp.testOnReturn}</value></property><property name="poolPreparedStatements"><value>${dbcp.poolPreparedStatements}</value></property></bean><bean id="sessionFactoryVideo"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource" ref="videoDataSource" /><property name="useTransactionAwareDataSource"><value>true</value></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">${hibernate.dialect}</prop><prop key="hibernate.connection.autocommit">${hibernate.connection.autocommit}</prop><prop key="hibernate.show_sql">${hibernate.show_sql}</prop></props></property></bean><bean id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource"><ref bean="dataSource" /></property><property name="useTransactionAwareDataSource"><value>true</value></property><property name="mappingLocations"><list><value>classpath*:/hibernate/ajxx/**/*.hbm.xml</value><value>classpath*:/hibernate/dzsd/**/*.hbm.xml</value><value>classpath*:/hibernate/ggfw/**/*.hbm.xml</value><value>classpath*:/hibernate/layy/**/*.hbm.xml</value><value>classpath*:/hibernate/platform/**/*.hbm.xml</value><value>classpath*:/hibernate/sfgk/**/*.hbm.xml</value><value>classpath*:/hibernate/xxfb/**/*.hbm.xml</value><value>classpath*:/hibernate/zxgk/**/*.hbm.xml</value><value>classpath*:/hibernate/feedback/**/*.hbm.xml</value><value>classpath*:/hibernate/fwpj/**/*.hbm.xml</value><value>classpath*:/hibernate/fy/**/*.hbm.xml</value><value>classpath*:/hibernate/ydbg/**/*.hbm.xml</value><value>classpath*:/hibernate/wsyj/**/*.hbm.xml</value><value>classpath*:/hibernate/wsyy/**/*.hbm.xml</value><value>classpath*:/hibernate/payment/**/*.hbm.xml</value></list></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">${hibernate.dialect}</prop><prop key="hibernate.connection.autocommit">${hibernate.connection.autocommit}</prop><prop key="hibernate.show_sql">${hibernate.show_sql}</prop></props></property></bean><bean id="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="dataSource" ref="dataSource" /><property name="sessionFactory" ref="sessionFactory" /><property name="nestedTransactionAllowed"><value>true</value></property></bean><bean id="transactionManagerVideo"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="dataSource" ref="videoDataSource" /><property name="sessionFactory" ref="sessionFactoryVideo" /><property name="nestedTransactionAllowed"><value>true</value></property></bean><bean id="transactionTemplate"class="org.springframework.transaction.support.TransactionTemplate"><property name="transactionManager" ref="transactionManager" /></bean><bean id="transactionTemplateVideo"class="org.springframework.transaction.support.TransactionTemplate"><property name="transactionManager" ref="transactionManagerVideo" /></bean><bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"><property name="dataSource" ref="dataSource" /></bean><bean id="videoJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"><property name="dataSource" ref="videoDataSource" /></bean><!-- 支持上传文件 --><bean id="multipartResolver"class="com.thunisoft.susong51.platform.spring.multipart.CustomMultipartResolver"><property name="maxInMemorySize" value="0" /><property name="resolveLazily" value="true" /><property name="maxUploadSize"><value>10485760</value></property></bean><!-- freemarker config --><bean id="freemarkerConfiguration"class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean"><property name="templateLoaderPath" value="/fmtpl/" /><property name="freemarkerSettings"><props><prop key="default_encoding">UTF-8</prop><prop key="output_encoding">UTF-8</prop><prop key="url_escaping_charset">UTF-8</prop><prop key="strict_bean_models">false</prop></props></property><property name="freemarkerVariables"><map><entry key="fm_ftp"><bean class="com.thunisoft.susong51.freemarker.EscapeFtpDirective" /></entry><entry key="fm_substr"><bean class="com.thunisoft.susong51.freemarker.SubStringDirective" /></entry></map></property></bean><!-- 声明式事务 --><tx:annotation-driven transaction-manager="transactionManager,transactionManagerVideo" /><!-- 加载安全模块 --><import resource="classpath:spring/spring-security.xml" /><!-- 加载服务模块 --><import resource="classpath:spring/spring-service.xml" /><!-- 加载DAO模块 --><import resource="classpath:spring/spring-dao.xml" /><!-- 远程调用模块 --><import resource="classpath:spring/spring-remote.xml" /><!-- 加载任务调度模块 --><import resource="classpath:spring/spring-quartz.xml" /><!-- 加载mq模块 --><import resource="classpath:spring/spring-rmq-consumer.xml" /></beans>
总结:
1.action需要注入service
<bean class="com.thunisoft.susong51.fwpj.action.FwpjAction"> <property name="fwpjService" ref="fwpjService" /><property name="ajService" ref="ajService"></property><property name="layyService" ref="layyService" /></bean>
2.service需要注入dao
<bean id="fwpjService"class="com.thunisoft.susong51.fwpj.service.impl.FwpjServiceImpl"><property name="fwpjDao" ref="fwpjDao"></property><property name="transactionTemplate" ref="transactionTemplate" /><property name="ajSsdlrService" ref="ajSsdlrService" /><property name="dsrService" ref="dsrService"></property><property name="proUserService" ref="proUserService" /><property name="ajService" ref="ajService"></property><property name="layyDao" ref="layyDao" /></bean>3.dao需要注入sessionFactory和jdbcTemplate,这两个bean都在applicationContext.xml中配置
<bean id="fwpjDao" class="com.thunisoft.susong51.fwpj.dao.impl.FwpjDaoImpl"><property name="sessionFactory" ref="sessionFactory" /><property name="jdbcTemplate" ref="jdbcTemplate" /></bean>
4.sessionFactory和jdbcTemplate都需要在applicationContext.xml文件中注入dataSource, dataSource也需要在applicationContext.xml中配置
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"><property name="dataSource" ref="dataSource" /></bean>
<bean id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource"><ref bean="dataSource" /></property><property name="useTransactionAwareDataSource"><value>true</value></property><property name="mappingLocations"><list><value>classpath*:/hibernate/ajxx/**/*.hbm.xml</value><value>classpath*:/hibernate/dzsd/**/*.hbm.xml</value><value>classpath*:/hibernate/ggfw/**/*.hbm.xml</value><value>classpath*:/hibernate/layy/**/*.hbm.xml</value><value>classpath*:/hibernate/platform/**/*.hbm.xml</value><value>classpath*:/hibernate/sfgk/**/*.hbm.xml</value><value>classpath*:/hibernate/xxfb/**/*.hbm.xml</value><value>classpath*:/hibernate/zxgk/**/*.hbm.xml</value><value>classpath*:/hibernate/feedback/**/*.hbm.xml</value><value>classpath*:/hibernate/fwpj/**/*.hbm.xml</value><value>classpath*:/hibernate/fy/**/*.hbm.xml</value><value>classpath*:/hibernate/ydbg/**/*.hbm.xml</value><value>classpath*:/hibernate/wsyj/**/*.hbm.xml</value><value>classpath*:/hibernate/wsyy/**/*.hbm.xml</value><value>classpath*:/hibernate/payment/**/*.hbm.xml</value></list></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">${hibernate.dialect}</prop><prop key="hibernate.connection.autocommit">${hibernate.connection.autocommit}</prop><prop key="hibernate.show_sql">${hibernate.show_sql}</prop></props></property></bean>
datasource配置
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close"><property name="driverClassName"><value>${dataSource.driverClass}</value></property><property name="url"><value>${dataSource.jdbcUrl}</value></property><property name="username"><value>${dataSource.user}</value></property><property name="password"><value>${dataSource.password}</value></property><property name="maxActive"><value>${dbcp.maxActive}</value></property><property name="initialSize"><value>${dbcp.initialSize}</value></property><property name="maxWait"><value>${dbcp.maxWait}</value></property><property name="minIdle"><value>${dbcp.minIdle}</value></property><property name="timeBetweenEvictionRunsMillis"><value>${dbcp.timeBetweenEvictionRunsMillis}</value></property><property name="minEvictableIdleTimeMillis"><value>${dbcp.minEvictableIdleTimeMillis}</value></property><property name="validationQuery"><value>${dbcp.validationQuery}</value></property><property name="testWhileIdle"><value>${dbcp.testWhileIdle}</value></property><property name="testOnBorrow"><value>${dbcp.testOnBorrow}</value></property><property name="testOnReturn"><value>${dbcp.testOnReturn}</value></property><property name="poolPreparedStatements"><value>${dbcp.poolPreparedStatements}</value></property></bean>
阅读全文
1 0
- spring需要添加哪些配置文件以及如何配置
- 建立一个能运行的spring-mvc程序,至少需要哪些配置以及jar包
- Spring配置文件(applicationContext.xml如何配置)
- Spring配置文件中如何使用外部配置文件配置数据库连接
- Spring配置文件以及基本常识
- APP如何发布到Google play 商店?以及有哪些需要注意的点
- APP如何发布到Google play 商店?以及有哪些需要注意的点
- nginx安装路径,查找配置文件以及如何配置
- spring mvc需要的 配置文件(以及相关类和接口的详细解释):
- spring mvc需要的 配置文件(以及相关类和接口的详细解释):
- 如何将Spring配置文件已配置的类Mock
- Spring配置文件里如何同时配置Spel表达和AOP
- 如何将Spring配置文件已配置的类Mock
- 学习springmvc时,配置spring配置文件时,不能提示?以及配置文件头可以从jar包里找吧?
- Spring与MyBatis整合需要哪些包
- spring配置文件配置aop
- Spring配置文件配置数据源
- spring配置文件配置过程
- Java 进阶78条学习总结
- UNIX编程专题-POSIX信号
- Android 通过图片Uri得到图片真实路径的
- C#_实现月度信息的快捷查询
- 位图索引
- spring需要添加哪些配置文件以及如何配置
- Ubuntu16.04完全离线安装mysql
- Python中文排序
- 【GDOI2018模拟7.7】寻找天哥
- 死锁原因排查
- 九大经典排序算法整理及其源代码分享(C/C++版)
- 正则表达式简介
- 腾讯云lnmp的安装
- 上传图片跟微信头像