教程集 www.jiaochengji.com
教程集 >  脚本编程  >  java  >  正文 linux中SSH环境搭建详解

linux中SSH环境搭建详解

发布时间:2016-10-13   编辑:jiaochengji.com
教程集为您提供linux中SSH环境搭建详解等资源,欢迎您收藏本站,我们将为您提供最新的linux中SSH环境搭建详解资源
SSH环境搭建虽然不简单但是只要一步步来操作配置也是可以快速完成了,我们来看一篇关于linux中SSH环境搭建详解吧,具体如下。

Struts部分

web.xml中配置:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
classpath:struts.xml配置

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd" >
<struts>
    <!-- 此处可使用include引入其它xml配置文件,如 include file="xxx/xx/xx/xx.xml" -->
</struts>
Spring部分

web.xml中配置

</context-param>
    <param-value>WEB-INF/appCtx-*.xml</param-value>
    <param-name>contextConfigLocation</param-name>
<context-param>

</listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<listener>
appCtx-ssi.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:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
   
    <context:annotation-config/>
    <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
    <context:component-scan base-package="com.ais"/>
   
    <!-- 配置sessionFactory -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="configLocation">
            <value>classpath:hibernate.cfg.xml</value>
        </property>
    </bean>
    <!-- 配置事务管理器 -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
            <ref bean="sessionFactory" />
        </property>
    </bean>
    <tx:annotation-driven transaction-manager="transactionManager" />
    <!-- 定义Hibernate模板对象 -->
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
</beans>
Hibernate部分

classpath:hibernate.cfg.xml配置

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" >
   
<hibernate-configuration>
    <session-factory>
        <!-- 数据库方言 -->
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <!-- 数据库驱动 -->
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <!-- 数据库连接信息 -->
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/server</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">server</property>
        <!-- 打印SQL语句 -->
        <property name="hibernate.show_sql">true</property>
        <!-- 不格式化SQL语句 -->
        <property name="hibernate.format_sql">false</property>
        <!-- 为Session指定一个自定义策略 -->
        <property name="hibernate.current_session_context_class">thread</property>
        <!-- C3P0 JDBC连接池 -->
        <property name="hibernate.c3p0.max_size">20</property>
        <property name="hibernate.c3p0.min_size">5</property>
        <property name="hibernate.c3p0.timeout">120</property>
        <property name="hibernate.c3p0.max_statements">100</property>
        <property name="hibernate.c3p0.idle_test_period">120</property>
        <property name="hibernate.c3p0.acquire_increment">2</property>
        <property name="hibernate.c3p0.validate">true</property>       
        <!-- 映射文件 -->
        <mapping resource="xxx/xxx/xxx/xxx.hbm.xml"/>
    </session-factory>
</hibernate-configuration>

您可能感兴趣的文章:
使用Homestead作为后端程序员的开发环境,介绍环境搭建
linux中SSH环境搭建详解
配置ssh,scp自动登陆
Jenkins添加Windows slave 及 Linux slave
golang ide 环境搭建_Go语言环境搭建详解(2020版)
运行php需要什么?
os.create指定路径 golang_Go语言(Golang)环境搭建详解
golang kite 环境搭建
php网站用什么服务器
Eclipse for PHP环境搭建运行测试全过程

[关闭]
~ ~