spring mvc的搭建——maven搭建spring mvc+ibatis项目(二)

[b][size=medium]1、需要引入的jar包,已经在上一节的pom.xml中设置了。[/size][/b]

[b][size=medium]2、web.xml[/size][/b]


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">



contextConfigLocation
classpath:/spring.xml




org.springframework.web.context.ContextLoaderListener





spring mvc servlet
springMvc

org.springframework.web.servlet.DispatcherServlet


spring mvc 配置文件
contextConfigLocation
classpath:spring-mvc.xml

1


springMvc
*.do





[b][size=medium]3、spring配置[/size][/b]
[b]1)spring-context.xml[/b]


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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="false" default-autowire="byName">



class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">


classpath:config/jdbc.properties
















class="org.springframework.jdbc.datasource.DataSourceTransactionManager">








classpath:config/ibatis.xml







补充:

##数据源配置
jdbc.driverClassName = com.mysql.jdbc.Driver
jdbc.url = jdbc:mysql://localhost:3306/jeecg
jdbc.username = root
jdbc.password =


具体的ibatis配置内容在之后的章节可见。

[b]2)spring-mvc.xml[/b]


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="false" default-autowire="byName">







class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">













class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">


text/html;charset=UTF-8






相关扫描包com.bluedon.common下的类见之后章节。

你可能感兴趣的:(spring,mvc,ibatis,maven搭建spring,mvc+ibatis)