The Applicationcontext.xml_ database of Bos-web module configuration for the ——— of BOS Logistics Project

Source: Internet
Author: User
Tags aop

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--> &Lt;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/> &LT;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.