java中的接口是类吗
195
2023-07-06
springmvc与mybatis集成配置实例详解
简单之美,springmvc,mybatis就是一个很好的简单集成方案,能够满足一般的项目需求。闲暇时间把项目配置文件共享出来,供大家参看:
1.首先我们来看下依赖的pom:
spring 选用的是4.1.4的版本,根据系统需要我们可以选择自己适合的版本。
2.相关的配置文件:
a)spring.xml
xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:context="http://springframework.org/schema/context" xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.1.xsd http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.1.xsd"> b)spring-mvc.xml xmlns:mvc="http://springframework.org/schema/mvc" xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:p="http://springframework.org/schema/p" xmlns:context="http://springframework.org/schema/context" xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.1.xsd http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.1.xsd http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc-4.1.xsd"> class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> class="org.springframework.web.servlet.view.InternalResourceViewResolver"> value="org.springframework.web.servlet.view.JstlView" /> c)spring-mybatis.xml xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:tx="http://springframework.org/schema/tx" xmlns:aop="http://springframework.org/schema/aop" xsi:schemaLocation=" http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.1.xsd http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.1.xsd http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.1.xsd "> init-method="init" destroy-method="close"> value="33" /> class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> d)web.xml classpath:spring-mvc.xml 使用了druid的数据源,在web中的详细配置可以参看代码。 以上所述是给大家介绍的springmvc与mybatis集成配置实例详解,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,会及时回复大家的,在此也非常感谢大家对我们网站的支持!
xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:context="http://springframework.org/schema/context"
xsi:schemaLocation="http://springframework.org/schema/beans
http://springframework.org/schema/beans/spring-beans-4.1.xsd
http://springframework.org/schema/context
http://springframework.org/schema/context/spring-context-4.1.xsd">
b)spring-mvc.xml
xmlns:mvc="http://springframework.org/schema/mvc" xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:p="http://springframework.org/schema/p" xmlns:context="http://springframework.org/schema/context" xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.1.xsd http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.1.xsd http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc-4.1.xsd"> class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> class="org.springframework.web.servlet.view.InternalResourceViewResolver"> value="org.springframework.web.servlet.view.JstlView" />
xmlns:mvc="http://springframework.org/schema/mvc" xmlns:xsi="http://w3.org/2001/XMLSchema-instance"
xmlns:p="http://springframework.org/schema/p" xmlns:context="http://springframework.org/schema/context"
xsi:schemaLocation="http://springframework.org/schema/beans
http://springframework.org/schema/beans/spring-beans-4.1.xsd
http://springframework.org/schema/context
http://springframework.org/schema/context/spring-context-4.1.xsd
http://springframework.org/schema/mvc
http://springframework.org/schema/mvc/spring-mvc-4.1.xsd">
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
class="org.springframework.web.servlet.view.InternalResourceViewResolver"> value="org.springframework.web.servlet.view.JstlView" />
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
value="org.springframework.web.servlet.view.JstlView" />
value="org.springframework.web.servlet.view.JstlView" />
c)spring-mybatis.xml
xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:tx="http://springframework.org/schema/tx" xmlns:aop="http://springframework.org/schema/aop" xsi:schemaLocation=" http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.1.xsd http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.1.xsd http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.1.xsd "> init-method="init" destroy-method="close"> value="33" /> class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> d)web.xml classpath:spring-mvc.xml 使用了druid的数据源,在web中的详细配置可以参看代码。 以上所述是给大家介绍的springmvc与mybatis集成配置实例详解,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,会及时回复大家的,在此也非常感谢大家对我们网站的支持!
xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns:tx="http://springframework.org/schema/tx"
xmlns:aop="http://springframework.org/schema/aop"
xsi:schemaLocation="
http://springframework.org/schema/beans
http://springframework.org/schema/beans/spring-beans-4.1.xsd
http://springframework.org/schema/tx
http://springframework.org/schema/tx/spring-tx-4.1.xsd
http://springframework.org/schema/aop
http://springframework.org/schema/aop/spring-aop-4.1.xsd
">
init-method="init" destroy-method="close"> value="33" />
init-method="init" destroy-method="close">
value="33" />
value="33" />
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
d)web.xml
classpath:spring-mvc.xml
使用了druid的数据源,在web中的详细配置可以参看代码。
以上所述是给大家介绍的springmvc与mybatis集成配置实例详解,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,会及时回复大家的,在此也非常感谢大家对我们网站的支持!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~