`
dowhathowtodo
  • 浏览: 778823 次
文章分类
社区版块
存档分类
最新评论

搭建一个spring mvc框架(一)

 
阅读更多
1、spring mvc配置文件mis-servlet.xml
<?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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">

<!-- 对controller包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 -->
<context:component-scan base-package="com.vanceinfo.mis" />

<!-- 启动Spring MVC的注解功能,完成请求和注解pojo的映射 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
</bean>

<!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>

</beans>
2、在src目录下创建数据库连接配置文件:jdbc.properties。文件内容如下:
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@172.19.7.139:1521:orcl
jdbc.username=messi
jdbc.passowrd=admin
jdbc.maxActive=100
jdbc.maxIdle=20
jdbc.maxWait=3000
日志配置文件log4j.properties,文件内容如下:
log4j.rootCategory=INFO, stdout
log4j.logger.org.springframework.oxm=DEBUG
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics