SSM (springmvc+mybatis+spring) Java Web construction Project __ "Development tools" ECLIPSE-J2EE

Source: Internet
Author: User
Tags pack java web
No.1 first built the Web engineering structure. Introduction to 1.1.1 development environment

Here I am using the MySQL database

The compiler version uses the JDK for 1.8

The development tool is using the Eclipse Mars version

The Web container uses a Tomcat version of version 7.0

Here I will write my own demo project directory structure screenshot to show the convenience of everyone new projects

This picture clearly shows my project clearly, first of all, a brief introduction, the project main package begins with Com.cntv. Below it is divided into several sub packages, namely Mapper, Controller, Service, DAO, Mapper, Logs, Config, base, entity, test package, Where the controller package is responsible for receiving the front request to perform part of the business logic of the action, familiar with the struts framework should know the action ha here I do not say in detail.  The mapper package is primarily responsible for mybatis framework entity mappings, which are the primary storage project configuration files. Other packages are not covered, they are regular packages.

No.2 ready for the appropriate Jar pack here I am using Spring is. 2.0 version MyBatis is a 3.3.0 version of the box selected jar package is a few dependencies jar pack don't think this is the complete jar pack and ....

So far, the jar pack is ready to start. Prepare the related configuration of the framework first is the Spring+mybatis associated configuration no.3 configuration framework related features of the configuration file

Create a new Spring-mybatis.xml file in the Config folder in the SRC directory and integrate and correlate the Spring+mybatis framework through this file

  <span style= "font-size: 14px;" ><</span><span style= "FONT-SIZE:18PX;" >?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 ">        <span style= "color: #ff0000;" ><!--  Automatic scanning  --></span>       <context:component-scan  base-package= "Com.cntv"  />       <span style= "color: #ff0000 ;" ><!--  Introducing configuration files  --></span>       <bean id= " Propertyconfigurer "           class=" Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer ">            <property name= "Location"  value= "Classpath:Jdbc.properties " />       </bean>           <bean id= "DataSource"  class= "Org.apache.commons.dbcp.BasicDataSource"             destroy-method= "Close" >            <property name= "Driverclassname"  value= "${driver}"  />            <property name= "url"  value= "${url}"  / >           <property name= "username"  value= " ${username} " />           <property name=" Password " value=" ${password} " />           < span style= "COLOR: #ff0000;" ><!--  Initialization connection size  --></span>           <property name= "InitialSize"  value= "${initialsize}" ></property>            <span style= "color: #ff0000;" ><!--  Connection pool Maximum number  --></span>            <property name= "maxactive"  value= "${maxactive}" ></property>            <span style= "COLOR: #ff0000;" ><!--  Connection Pool max idle  --></span>            <property name= "Maxidle"  value= "${maxidle}" ></property>            <span style= "COLOR: #ff0000;" ><!--  Connection pool minimum idle  --></span>            <property name= "Minidle"  value= "${minidle}" ></property>            <span style= "COLOR: #ff0000;" ><!--  Get connection Maximum wait time  --></span>            <property name= "maxwait"  value= "${maxwait}" ></property>        </bean>          <span style= "color: #ff0000;" ><!-- spring and MyBatis perfect integration, do not need mybatis configuration mapping file  --></span>        <bean id= "Sqlsessionfactory"  class= "Org.mybatis.spring.SqlSessionFactoryBean" >            <property name= "DataSource"  ref= "DataSource " />           <span style=" color: #ff0000; ><!--  Auto scan mapping.xml files  --></span>            <property name= "Mapperlocations"  value= "classpath:Com/cntv/mapper/*.xml "></property>       </bean>           <span style= "color: #ff0000;" ><!--The package name of the  dao interface, Spring automatically finds the class under it  --></span>       < bean class= "Org.mybatis.spring.mapper.MapperScannerConfigurer" >            <property name= "Basepackage"  value= "Com.cn.hnust.dao"  />            <property name=

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.