首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

ssh环境筹建

2012-07-22 
ssh环境搭建所谓SSH,即struts+spring+hibernate的J2EE架构。?1.环境下载:Spring 3.1.1 + Struts 2.3.1.2 +

ssh环境搭建

所谓SSH,即struts+spring+hibernate的J2EE架构。

?

1.环境下载:Spring 3.1.1 + Struts 2.3.1.2 + Hibernate 4.1

?

http://struts.apache.org/download.cgi

?

http://www.springsource.org/download

?

http://in.relation.to/Bloggers/HibernateORM412Release?

?

?

重要配置:

?

Web.xml

    1. <?xml?version="1.0"?encoding="UTF-8"?>??<beans?xmlns="http://www.springframework.org/schema/beans"??
    2. ????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?xmlns:jee="http://www.springframework.org/schema/jee"??????xmlns:tx="http://www.springframework.org/schema/tx"?xmlns:aop="http://www.springframework.org/schema/aop"??
    3. ????xmlns:p="http://www.springframework.org/schema/p"?xmlns:util="http://www.springframework.org/schema/util"??????xmlns:tool="http://www.springframework.org/schema/tool"?xmlns:context="http://www.springframework.org/schema/context"??
    4. ????xsi:schemaLocation="http://www.springframework.org/schema/beans???????http://www.springframework.org/schema/beans/spring-beans.xsd??
    5. ?????http://www.springframework.org/schema/tx???????http://www.springframework.org/schema/tx/spring-tx.xsd??
    6. ?????http://www.springframework.org/schema/aop???????http://www.springframework.org/schema/aop/spring-aop.xsd??
    7. ?????http://www.springframework.org/schema/jee???????http://www.springframework.org/schema/jee/spring-jee.xsd??
    8. ?????http://www.springframework.org/schema/context???????http://www.springframework.org/schema/context/spring-context.xsd??
    9. ?????http://www.springframework.org/schema/util???????http://www.springframework.org/schema/util/spring-util.xsd??
    10. ?????http://www.springframework.org/schema/tool???????http://www.springframework.org/schema/tool/spring-tool.xsd"??
    11. ????default-lazy-init="true"?default-autowire="byName">????
    12. ????<bean?id="propertyConfigurer"??????????class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">??
    13. ????????<property?name="locations">??????????????<list>??
    14. ????????????????<value>classpath:/dataBaseInfo.properties</value>??????????????</list>??
    15. ????????</property>??????</bean>??
    16. ??????<!--?<bean?id="dataSource"?class="org.springframework.jndi.JndiObjectFactoryBean"???
    17. ????????p:jndiName="java:comp/env/jdbc/MySSH"?/>?-->????
    18. ????<!--?BoneCP?-->??????<bean?id="dataSource"?class="com.jolbox.bonecp.BoneCPDataSource"??
    19. ????????p:driverClass="${jdbc.driver}"?p:jdbcUrl="${jdbc.url}"?p:username="${jdbc.username}"??????????p:password="${jdbc.password}"?p:idleConnectionTestPeriodInMinutes="${idleConnectionTestPeriodInMinutes}"??
    20. ????????p:idleMaxAgeInMinutes="${idleMaxAgeInMinutes}"??????????p:maxConnectionsPerPartition="${maxConnectionsPerPartition}"??
    21. ????????p:minConnectionsPerPartition="${minConnectionsPerPartition}"??????????p:partitionCount="${partitionCount}"?p:acquireIncrement="${acquireIncrement}"??
    22. ????????p:statementsCacheSize="${statementsCacheSize}"??????????p:disableConnectionTracking="${disableConnectionTracking}"??
    23. ????????p:releaseHelperThreads="${releaseHelperThreads}"?destroy-method="close"?/>????????
    24. ????<bean?id="sessionFactory"??????????class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"??
    25. ????????p:dataSource-ref="dataSource">????
    26. ????????<property?name="mappingDirectoryLocations">??????????????<list>??
    27. ????????????????<value>classpath:/com/eriloan/web/test/bo/</value>??????????????</list>??
    28. ????????</property>????
    29. ????????<property?name="hibernateProperties">??????????????<props>??
    30. ????????????????<prop?key="hibernate.dialect">${hibernate.dialect}</prop>??????????????????<prop?key="hibernate.show_sql">${hibernate.show_sql}</prop>??
    31. ????????????????<prop?key="hibernate.format_sql">${hibernate.format_sql}</prop>??????????????????<prop?key="hibernate.use_sql_comments">${hibernate.use_sql_comments}</prop>??
    32. ????????????????<prop?key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>??????????????????<prop?key="hibernate.max_fetch_depth">${hibernate.max_fetch_depth}</prop>??
    33. ????????????????<prop?key="hibernate.jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop>??????????????????<prop?key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>??
    34. ????????????????<prop?key="hibernate.cache.provider_class">${hibernate.cache.provider_class}</prop>??????????????????<prop?key="hibernate.order_updates">${hibernate.order_updates}</prop>??
    35. ????????????????<prop?key="hibernate.query.factory_class">${hibernate.query.factory_class}</prop>??????????????????<prop?key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>??
    36. ????????????????<prop?key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>??<!--?????????????????<prop?key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>?-->??
    37. ????????????</props>??????????</property>??
    38. ????</bean>????
    39. ????<bean?id="transactionManager"??????????class="org.springframework.orm.hibernate4.HibernateTransactionManager"?/>??
    40. ??????<bean?id="transactionInterceptor"??
    41. ????????class="org.springframework.transaction.interceptor.TransactionInterceptor"??????????p:transactionManager-ref="transactionManager">??
    42. ????????<property?name="transactionAttributes">??????????????<props>??
    43. ????????????????<prop?key="get*">PROPAGATION_REQUIRED,readOnly</prop>??????????????????<prop?key="find*">PROPAGATION_REQUIRED,readOnly</prop>??
    44. ????????????????<prop?key="select*">PROPAGATION_REQUIRED,readOnly</prop>??????????????????<prop?key="query*">PROPAGATION_REQUIRED,readOnly</prop>???????????????
    45. ????????????????<prop?key="sync*">PROPAGATION_REQUIRED</prop>??????????????????<prop?key="finish*">PROPAGATION_REQUIRED</prop>??
    46. ????????????????<prop?key="add*">PROPAGATION_REQUIRED</prop>??????????????????<prop?key="insert*">PROPAGATION_REQUIRED</prop>??
    47. ????????????????<prop?key="edit*">PROPAGATION_REQUIRED</prop>??????????????????<prop?key="update*">PROPAGATION_REQUIRED</prop>??
    48. ????????????????<prop?key="save*">PROPAGATION_REQUIRED</prop>??????????????????<prop?key="remove*">PROPAGATION_REQUIRED</prop>??
    49. ????????????????<prop?key="delete*">PROPAGATION_REQUIRED</prop>??????????????????<prop?key="*">PROPAGATION_REQUIRED,-java.lang.Exception</prop>??
    50. ????????????</props>??????????</property>??
    51. ????</bean>????
    52. ????<bean?id="ProxyCreator"??????????class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"??
    53. ????????p:beanNames="*Service,*ServiceImpl"?p:interceptorNames="transactionInterceptor"?/>????
    54. ????<!--?数据库操作Bean?-->??????<bean?id="dao"?class="dao.DaoImpl"?scope="singleton"?/>??
    55. ??????<!--Service?原始Bean?-->??
    56. ????<bean?id="baseService"?class="service.BaseServiceImpl"?scope="singleton"?/>????????
    57. ????<!--Action?原始Bean?-->??????<bean?id="baseAction"?class="action.BaseAction"?scope="prototype"?/>??
    58. ??</beans>??

热点排行