javaee配置文件

web.xml
1.配置spring核心监听器,默认以WEB-INF/applicationContext.xml;
org.springframework.web.context.ContextLoadListener
2.springmvc前端控制器
org.springframework.web.servlet.DiapatcherServlet
3.编码过滤器
org.springframework.web.filter.CharacterEncodingFilter
4.jsp配置

springmvc:

<cotext:component-scan base-package="org.chenbin.controller"/>
//mvc默认配置方案
<mvc:annotation-driven/>
//mvc使用默认servlet响应静态文件
<mvc:default-servlet-handler/>
//mvc拦截器
<mvc:interceptors>
<mvc:interceptor>
    <mvc:mapping path="/*"/>
    <bean class="org.chenbin.AuthorizedInterceptor"/>
</mvc:interceptor>

</mvc:interceptors>
//视图解析器
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
    <value>/WEB-INF/jsp</value>
</property>

<property name="suffix">
    <value>.jsp</value>
</property>
</bean>

//文件上传
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize">
    <value>13132132</value>
</property>
<property name="defaultEncoding">
    <value>UTF-8</value>
</property>
</bean>

applicationContext.xml

<mybatis:scan base-package=""/>
扫描注解类
<context:component-scan base-package=""/>

配置c3po数据源
com.mchange.v2.c3po.ComboPooledDataSorce

配置sqlSessionFactory
org.mybatis.spring.SqlSessionFactoryBean

配置jdbc事务管理
org.springframework.jdbc.datasource.DataSorceTransactionManager

启用支持annotation注解方式事务管理

猜你喜欢

转载自blog.csdn.net/qq_37740841/article/details/80086861