Configuration information of web. xml in SSM, ssmweb. xml

Source: Internet
Author: User

Configuration information of web. xml in SSM, ssmweb. xml

Recently, I have learned how to build an SSM framework project. In fact, this project is free to keep trying and failing, so that I can be more impressed.

The following describes the configuration information of web. xml in the project:

<? 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: p = "http://www.springframework.org/schema/p"
Xmlns: context = "http://www.springframework.org/schema/context"
Xmlns: mvc = "http://www.springframework.org/schema/mvc"
Xsi: schemaLocation = "http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
Http://www.springframework.org/schema/context
Http://www.springframework.org/schema/context/spring-context-3.1.xsd
Http://www.springframework.org/schema/mvc
Http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd>

<! -- Automatic scanning (the project package scanned here is the basic package of the project) -->
<Context: component-scan base-package = "com. su. ssm"/>

<! -- Introduce the database connection configuration file: (jdbc. properties) -->
<Bean id = "propertyConfigurer"
Class = "org. springframework. beans. factory. config. PropertyPlaceholderConfigurer">
<Property name = "location" value = "classpath: jdbc. properties"/>
</Bean>
<! -- Import the database connection configuration property file: Get the relevant value -->
<Bean id = "dataSource" class = "org. apache. commons. dbcp. BasicDataSource" 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}"/>
<! -- Initialize the connection size -->
<Property name = "initialSize" value = "$ {initialSize}"> </property>
<! -- Maximum number of connection pools -->
<Property name = "maxActive" value = "$ {maxActive}"> </property>
<! -- Maximum idle connection pool -->
<Property name = "maxIdle" value = "$ {maxIdle}"> </property>
<! -- Minimum idle connection pool -->
<Property name = "minIdle" value = "$ {minIdle}"> </property>
<! -- Get the maximum waiting time for a connection -->
<Property name = "maxWait" value = "$ {maxWait}"> </property>
</Bean>

<! -- (Import of object classes): spring and MyBatis are perfectly integrated, and the configuration ing file of mybatis is not required: the import value of object classes -->
<Bean id = "sqlSessionFactory" class = "org. mybatis. spring. SqlSessionFactoryBean">
<Property name = "dataSource" ref = "dataSource"/>
<! -- Automatically scans mapping. xml files (ing file scanning) -->
<Property name = "mapperLocations" value = "classpath: com/su/ssm/mapping/*. xml"> </property>
<Property name = "typeAliasesPackage" value = "com. su. ssm. pojo"/>
</Bean>

<! -- (Interface awareness) The package name of the DAO interface. Spring will automatically find the class under it: the import interface of the object class -->
<Bean class = "org. mybatis. spring. mapper. MapperScannerConfigurer">
<Property name = "basePackage" value = "com. su. ssm. dao"/>
<Property name = "sqlSessionFactoryBeanName" value = "sqlSessionFactory"> </property>
</Bean>

<! -- (Transaction Management) transaction manager, use JtaTransactionManager for global tx -->
<Bean id = "transactionManager"
Class = "org. springframework. jdbc. datasource. DataSourceTransactionManager">
<Property name = "dataSource" ref = "dataSource"/>
</Bean>
</Beans>

The configuration above is very clear. Try it more than I don't know.

 

Related Article

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.