web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>SpringHibernateJsfTest</display-name>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.h3c.itac.interaction.listener.InteractionManagement</listener-class>
    </listener>
    <listener>
        <listener-class>com.h3c.itac.login.listener.SessionListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.h3c.itac.backstage.listener.OperationLogHandleListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.h3c.itac.backstage.listener.VIPAcountHandleListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.h3c.itac.backstage.listener.AdeskQuotaHandleListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.h3c.itac.sip.listener.SipDataUpdateListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/config/spring/applicationContext.xml</param-value>
    </context-param>
    <filter>
        <filter-name>open</filter-name>
        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>open</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>sessionFilter</filter-name>
        <filter-class>com.h3c.itac.login.filter.SessionFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>sessionFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>characterEncoding</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>characterEncoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <servlet>
        <servlet-name>springServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/config/spring/servlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>springServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>BootServlet</servlet-name>
        <servlet-class>com.h3c.itac.baseline.common.BootServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
</web-app>

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:security="http://www.springframework.org/schema/security"
    xmlns:context="http://www.springframework.org/schema/context"
    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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <!-- bean的生命周期回调函数 <bean class="com.test.control.MyBeanPostProcessor"/> -->
    <context:component-scan base-package="com.h3c.itac" >
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass">
            <value>com.mysql.jdbc.Driver</value>
        </property>
        <property name="jdbcUrl">
            <value>jdbc:mysql://localhost:3306/itac?rewriteBatchedStatements=true</value>
        </property>
        <property name="user">
            <value>root</value>
        </property>
        <property name="password">
            <value>root</value>
        </property>
        <!--连接池中保留的最小连接数。 -->
        <property name=" />
        <!--连接池中保留的最大连接数。Default:  -->
        <property name=" />
        <!--最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default:  -->
        <property name=" />
        <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default:  -->
        <property name=" />
        <property name=" />
        <property name=" />
        <!--每60秒检查所有连接池中的空闲连接。Default:  -->
        <property name=" />
        <!--定义在从数据库获取新连接失败后重复尝试的次数。Default:  -->
        <property name=" />
        <property name="breakAfterAcquireFailure" value="true" />
        <property name="testConnectionOnCheckout" value="false" />

    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan" value="com.h3c" />
        <property name="hibernateProperties">
            <value>
                hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
                hibernate.connection.autocommit=false
                hibernate.hbm2ddl.auto=update
                hibernate.show_sql=false
                hibernate.format_sql=false
                hibernate.jdbc_batch_size=
                hibernate.cache.use_second_level_cache=true
                hibernate.cache.use_query_cacroxyhe=false
                hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
            </value>
        </property>
        <property name="mappingResources">
            <list>
                <value>com/h3c/itac/baseline/po/DeviceNode.hbm.xml</value>
                <value>com/h3c/itac/baseline/po/ChangeBase.hbm.xml</value>
            </list>
        </property>
    </bean>

    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="></property>  <!-- 上传文件最大值 ,单位byte -->
        <property name="defaultEncoding" value="utf-8"></property>
    </bean>

    <bean id="txManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"></property>
        <property name="nestedTransactionAllowed" value="true" />

    </bean>
    <tx:annotation-driven transaction-manager="txManager" proxy-target-class="true"
        mode="proxy" />

    <aop:aspectj-autoproxy proxy-target-class="true"/>

</beans>

beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd">

</beans>

controllers.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:mvc="http://www.springframework.org/schema/mvc"
    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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    <!--默认的 -->
    <mvc:view-controller path="/" view-name="home" />

    <context:component-scan base-package="com.h3c.itac">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"/>
    </context:component-scan>
</beans>

servlet-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
                        http://www.springframework.org/schema/task
                        http://www.springframework.org/schema/task/spring-task-3.0.xsd">

    <annotation-driven />
    <task:annotation-driven/>
    <!-- <interceptors>
        拦截所有
        <interceptor>
            <mapping path="/*"/>
            <beans:bean class="com.h3c.itac.interceptor.TimeSpendInterceptor"/>
        </interceptor>
    </interceptors> -->

    <resources mapping="/resources/**" location="/resources/" />

    <beans:bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>

    <beans:import resource="/controllers.xml"/>
    <beans:import resource="/beans.xml"/>
</beans:beans>

springmvc+spring+hibernate的更多相关文章

  1. Springmvc+Spring+Hibernate搭建方法及实例

    Springmvc+Spring+Hibernate搭建方法及实例  

  2. SpringMVC+Spring+Hibernate的小样例

    Strusts2+Spring+Hibernate尽管是主流的WEB开发框架,可是SpringMVC有越来越多的人使用了.确实也很好用.用得爽! 这里实现了一个SpringMVC+Spring+Hib ...

  3. Springmvc+Spring+Hibernate搭建方法

    Springmvc+Spring+Hibernate搭建方法及example 前面两篇文章,分别介绍了Springmvc和Spring的搭建方法,本文再搭建hibernate,并建立SSH最基本的代码 ...

  4. Maven搭建springMVC+spring+hibernate环境

    这次不再使用struts2做控制器,采用spring自己的springMVC框架实现. 首先,改写pom.xml文件,不需要struts2的相关jar了. pom.xml <project xm ...

  5. SpringMVC+Spring+Hibernate整合开发

    最近突然想认真研究下java web常用框架,虽然现在一直在用,但实现的整体流程不是很了解,就在网上搜索资料,尝试自己搭建,以下是自己的搭建及测试过程. 一.准备工作: 1/安装并配置java运行环境 ...

  6. SpringMVC+Spring+Hibernate个人家庭财务管理系统

    项目描述 Hi,大家好,今天分享的项目是<个人家庭财务管理系统>,本系统是针对个人家庭内部的财务管理而开发的,大体功能模块如下: 系统管理模块 验证用户登录功能:该功能主要是验证用户登录时 ...

  7. SpringMVC+Spring+Hibernate+Maven+mysql整合

    一.准备工作 1.工具:jdk1.7.0_80(64)+tomcat7.0.68+myeclipse10.6+mysql-5.5.48-win322. 开发环境安装配置.Maven项目创建(参考:ht ...

  8. spring(一)--spring/springmvc/spring+hibernate(mybatis)配置文件

    这篇文章用来总结一下spring,springmvc,spring+mybatis,spring+hibernate的配置文件 1.web.xml 要使用spring,必须在web.xml中定义分发器 ...

  9. SpringMVC+Spring+Hibernate框架整合原理,作用及使用方法

    转自:https://blog.csdn.net/bieleyang/article/details/77862042 SSM框架是spring MVC ,spring和mybatis框架的整合,是标 ...

  10. 搭建SpringMVC+Spring+Hibernate平台

    一. 开发环境 1. 点击此查看并下载需要的 Eclipse IDE for Java EE Developers 开发工具,推荐选用32位   2. 点击此查看并下载需要的 MySQL Server ...

随机推荐

  1. angularjs 弹出框 $modal 参数(转)

    angularjs 弹出框 $modal   $modal只有一个方法:open,该方法的属性有: templateUrl:模态窗口的地址 template:用于显示html标签 scope:一个作用 ...

  2. GET和POST

    Ajax与Comet 1. Ajax Asynchronous Javascript+xml :能够向服务器请求额外的数据而无需卸载页面. Ajax技术的核心是XMLHttpRequest 对象(简称 ...

  3. [Linux]使用PHP编写Gearman的Worker守护进程

    在我之前的文章中,介绍过Gearman的使用.在我的项目中,我使用了PHP来编写一直运行的Worker.如果按照Gearman官方推荐的例子,只是简单的一个循环来等待任务,会有一些问题,包括:1.当代 ...

  4. 错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)

    Fragment newfragment =new MyFragment();fragmentTransaction.replace(R.layout.activity_main,newfragmen ...

  5. Python多进程(2)——mmap模块与mmap对象

    本文介绍Python mmap模块与mmap对象的用法. mmap 模块提供“内存映射的文件对象”,mmap 对象可以用在使用 plain string 的地方,mmap 对象和 plain stri ...

  6. javaWeb项目部署到阿里云服务器步骤

    记录web项目部署到阿里云服务器步骤 (使用 web项目.阿里云服务器.Xftp.Xshell),敬请参考和指正 1.将要部署的项目打包成WAR文件格式,可以在MyEclipse.Eclipse都可以 ...

  7. Indy FTP 警告:Only one TIdAntiFreeze can be active in an application

    > Should I use a AntiFreeze component on every form I have a TIdTCPClient > component?  Or is ...

  8. Linux之tomcat日志管理

    tomcat 的日志输出catalina.out,变大,可使用下面方式解决. cronolog. http://blog.csdn.net/huang_xw/article/details/61942 ...

  9. Spring中文文档

    前一段时间翻译了Jetty的一部分文档,感觉对阅读英文没有大的提高(*^-^*),毕竟Jetty的受众面还是比较小的,而且翻译过程中发现Jetty的文档写的不是很好,所以呢翻译的兴趣慢慢就不大了,只能 ...

  10. Linux学习笔记(3)-常用命令

    江湖传言,Linux和Windows不同,他主要的用途是在一些服务器,或者片内系统上,所以人机交互界面自然就没有Windows那么漂亮,其实也没有那个必要. 所以,学习Linux的第一步,就是学习他那 ...