Spring 详细配置
来源:互联网 发布:php微信第三方登录sdk 编辑:程序博客网 时间:2024/05/16 13:56
1、 <!-- 启用spring mvc 注解 -->
<context:annotation-config />
2、<!-- 设置使用注解的类所在的jar包 -->
<context:component-scan base-package="com.*" />
3、<!-- 完成请求和注解POJO的映射 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapt er" />
4、<!-- 对转向页面的路径解析。prefix:前缀, suffix:后缀 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"/>
<property name="suffix" value=""/><!--可为空,方便实现自已的依据扩展名来选择视图解释类的逻辑 -->
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
</bean>
5、数据库配置
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/super?useUnicode=true&characterEncodin g=utf8"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
<property name="maxActive" value="5"/>
<property name="initialSize" value="3"/>
<property name="maxIdle" value="3"/>
<property name="maxWait" value="30"/>
<property name="validationQuery" value="select now()"/>
</bean>
6、<!-- 为MyBatis配置SQL工厂 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:mybatis/sqlmap-config.xml"></property>
</bean>
7、<!-- 事务(注解 )-->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target- class="true"/>
8、<!-- Mybatis MapperScannerConfigurer 自动扫描 将Mapper接口生成代理注入到Spring-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.dao" />
</bean>
- Spring Security 详细配置
- BoneCP-Spring详细配置
- BoneCP-Spring详细配置
- Spring详细配置
- spring mvc详细配置
- Spring 详细配置
- spring 定时器 详细配置
- Spring - Websocket详细配置
- Spring-02-详细配置
- BoneCP-Spring详细配置
- spring security4 详细配置
- BoneCP-Spring详细配置
- Spring中c3p0详细配置
- spring配置的详细介绍
- spring mvc的详细配置
- spring 整合 mybatis 详细配置
- Spring + MyBatis配置详细教程
- Spring Boot 详细日志配置
- 小学生作文
- android 自定义Dialog背景透明及显示位置设置
- 用心对待生活中的一切
- 小学生作文
- 定义progressbar
- Spring 详细配置
- Android开发使用adb时出现adb server is out of date的解决方法
- hdu 4358 Boring counting(dfs序+莫队算法)
- UIDatePicker的简单设置
- xen网络前后端交互
- NYOJ234吃土豆
- 执行路径问题
- photoshop--滤镜动作自动
- Spring MVC学习笔记(一) DispatcherServlet分析