懒人专用SSH框架下的基本配置
生活随笔
收集整理的這篇文章主要介紹了
懒人专用SSH框架下的基本配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
????項目結束,馬上就要出去找工作了,這段時間也不用寫項目,就整理了一些以后可能會用的到的配置,還有一個原因就是我不想去記憶。。。。。。。。。
????SSH下application.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:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"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.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-3.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-3.0.xsd"><!--?事務?--><bean?id="txManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property?name="sessionFactory"?ref="sessionFactory"></property></bean><!--?鏈接點?--><tx:advice?id="txAvice"?transaction-manager="txManager"><tx:attributes><tx:method?name="find*"?propagation="NOT_SUPPORTED"read-only="false"?/><tx:method?name="query*"?propagation="NOT_SUPPORTED"read-only="false"?/><tx:method?name="save*"?propagation="REQUIRED"?/><tx:method?name="add*"?propagation="REQUIRED"?/><tx:method?name="delete*"?propagation="REQUIRED"?/><tx:method?name="update*"?propagation="REQUIRED"?/><tx:method?name="remove*"?propagation="REQUIRED"?/><tx:method?name="keep*"?propagation="REQUIRED"?/></tx:attributes></tx:advice><!--?AOP切面?--><aop:config><aop:pointcutexpression="execution(*?com.hpsvse.xyz.qqzone.dao.impl.*.*(..))"id="myPoint"?/><aop:advisor?advice-ref="txAvice"?pointcut-ref="myPoint"?/></aop:config><bean?id="dataSource"?class="org.apache.commons.dbcp.BasicDataSource"><property?name="driverClassName"?value="oracle.jdbc.driver.OracleDriver"></property><property?name="url"?value="jdbc:oracle:thin:@localhost:1521:orcl"></property><property?name="username"?value="QQZone"></property><property?name="password"?value="qqzone"></property></bean><bean?id="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property?name="dataSource"><ref?bean="dataSource"?/></property><property?name="hibernateProperties"><props><prop?key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop></props></property><property?name="mappingResources"><list><!--?xml映射實體?--><value>com/hpsvse/xyz/qqzone/entity/Friendmsg.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Logact.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Users.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Message.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Marks.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Activitys.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Dic.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Say.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Fridends.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Album.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Photo.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Comments.hbm.xml</value><value>com/hpsvse/xyz/qqzone/entity/Pwdprotect.hbm.xml</value></list></property></bean><!--?開啟注解?--><context:annotation-config></context:annotation-config><context:component-scan?base-package="com.hpsvse.xyz.qqzone.*"></context:component-scan> </beans>????????SSH下web.xml基本配置
<?xml?version="1.0"?encoding="UTF-8"?> <web-app?version="2.5"?xmlns="http://java.sun.com/xml/ns/javaee"?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?xsi:schemaLocation="http://java.sun.com/xml/ns/javaee?http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><welcome-file-list><welcome-file>login.jsp</welcome-file></welcome-file-list><!--?opensessionview?--><servlet><servlet-name>ImageAction</servlet-name><servlet-class>com.hpsvse.xyz.qqzone.web.action.ImageAction</servlet-class></servlet><servlet-mapping><servlet-name>ImageAction</servlet-name><url-pattern>/ImageAction</url-pattern></servlet-mapping><filter><filter-name>opensessionview</filter-name><filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class></filter><filter-mapping><filter-name>opensessionview</filter-name><url-pattern>/*</url-pattern></filter-mapping><!--?struts過濾器?--><filter><filter-name>strutsFilter</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>strutsFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><!--?加載applicationContext.xml?--><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext*.xml</param-value></context-param><!--?加載監聽?--><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener></web-app>轉載于:https://blog.51cto.com/idlong/1687652
總結
以上是生活随笔為你收集整理的懒人专用SSH框架下的基本配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Windows 8.1 升级到专业版
- 下一篇: Android Sqlite