Applicationcontextxml of 07bos-web module configuration of BOS Logistics Project Dbproperties file Two applicationcontextxml three configuration instructions four or five source download
BOS Logistics Project ——— bos-web module Configuration applicationcontext.xml One, db.properties files
This file configures the database connection
Jdbc.driverclass=com.mysql.jdbc.driver
jdbc.jdbcurl=jdbc:mysql:///bosdb
jdbc.user=xiaoming
jdbc.password=123456
Second, Applicationcontext.xml
<?xml version= "1.0" encoding= "UTF-8"?> <beans xmlns= "Http://www.springframework.org/schema/beans" Xmlns:xs
I= "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" xs i:schemalocation= "Http://www.springframework.org/schema/beans Http://www.springframework.org/schem A/beans/spring-beans.xsd Http://www.springframework.org/schema/context htt P://www.springframework.org/schema/context/spring-context.xsd Http://www.springframework.org/schem A/AOP http://www.springframework.org/schema/aop/spring-aop.xsd http://www. Springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd "> ;! --Load Property file--> ≪context:property-placeholder location= "Classpath:db.properties"/> <!--configuration data source--> <bean id= "Datasou Rce "class=" Com.mchange.v2.c3p0.ComboPooledDataSource "> <property name=" driverclass "value=" ${jdbc.drivercla SS} "/> <property name=" Jdbcurl "value=" ${jdbc.jdbcurl} "/> <property name=" user "value=" ${JDBC. User} "/> <property name= password" value= "${jdbc.password}"/> </bean> <!--configuration Localsessi Onfactorybean,spring provides factory beans for consolidating hibernate--> <bean id= "Sessionfactory" Org.springframework.orm.hibernate5.LocalSessionFactoryBean "> <property name=" dataSource "ref=" DataSource "/&"
Gt
<!--injection Hibernate related property configuration--> <property name= "Hibernateproperties" > <props> <prop key= "Hibernate.dialect" >org.hibernate.dialect.MySQL5Dialect</prop> <prop key= "H" Ibernate.hbm2ddl.auto ">update</prop> <prop key= "Hibernate.show_sql" >true</prop> <prop key= "Hibernate.format_sql" >true</pro P> </props> </property> <!--inject hibernate mapping file--> <property NA Me= "Mappinglocations" > <list> <value>classpath:com/qwm/bos/domain/*.xml</val ue> </list> </property> </bean> <!--configuration transaction manager--> <bean id= " TransactionManager "class=" Org.springframework.orm.hibernate5.HibernateTransactionManager "> <property name= "Sessionfactory" ref= "Sessionfactory"/> </bean> <!--component Scan--> <context:component-scan base- Package= "Com.qwm.bos"/> <!--support Spring annotations--> <context:annotation-config/> <TX:ANNOTATION-DR
Iven/> </beans>
III. Configuration Instructions
Applicationcontext.xml configuration, and we previously said the configuration is the same, mainly is the mapping file configuration is different, previously we used the configuration is
<!--introduces ORM metadata, specifies the package path where the ORM metadata resides, and spring automatically reads all the configurations in the package-->
<property name= "Mappingdirectorylocations" value= "Classpath:com/qwm/ssh_crm/domain" ></property>
Now we use the configuration
<!--inject Hibernate mapping file-->
<property name= "mappinglocations" >
<list>
<value> classpath:com/qwm/bos/domain/*.xml</value>
</list>
</property>
Four
SSH integration 06--hibernate and spring integration for SSH and SSM learning
SSH and SSM learning SSH integration 07--spring integration c3p0 Connection pool V, source download
Https://github.com/wimingxxx/bos-parent