SpringMVC+MyBatis 相信已经是如今企业开发中经常使用技术了。

由于一些需求,我们须要集成JMS(我使用的是ActiveMQ)。大家应该都知道。MQ也能够觉得是一个数据源。数据也是数据源。

这样的情况下,假设我们在一个方法内操作JMS和数据库。我们就须要保证这种方法运行须要满足原子性。

这也就意味这一个问题,我们要多个数据源在同一个事务中。

这里不枚举市面上的全部解决方式,事实上atomikos JTA 是一个比較不错分布式事务管理器。

当然假设没有使用到JMS,在须要多数据源(也就是须要连接多个数据库)的情况相同适用。

以下将项目的主要配置贴出来共享:

1、applicationContext.xml

<?

xml version="1.0" encoding="GBK"?>
<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"
xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.13.0.xsd"> <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/> <!-- 配置扫描路径 -->
<context:component-scan base-package="com.hvgroup.zhuhai10086.jms">
<!-- 仅仅扫描Service。也能够加入Repostory,可是要把Controller排除在外,Controller由spring-mvc.xml去载入 -->
<!-- <context:include-filter type="annotation" expression="org.springframework.stereotype.Service" /> -->
<!-- <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository" /> -->
<!-- <context:include-filter type="annotation" expression="org.springframework.stereotype.Component" /> -->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan> <!-- 读取环境变量(自己定义扩展) -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:config/config.properties</value>
</list>
</property>
</bean> <import resource="classpath:spring/applicationContext-Service.xml" /> </beans>

2、applicationContext-Service.xml

<?

xml version="1.0" encoding="GBK"?

>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd"> <!-- JDBC连接数据库数据源 -->
<!-- <bean id="dataSource" -->
<!-- class="org.springframework.jdbc.datasource.DriverManagerDataSource"> -->
<!-- <property name="driverClassName" value="${jdbc.driverClassName}" /> -->
<!-- <property name="url" value="${jdbc.url}" /> -->
<!-- <property name="username" value="${jdbc.username}" /> -->
<!-- <property name="password" value="${jdbc.password}" /> -->
<!-- </bean> --> <!-- DBCP连接池 -->
<!-- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" -->
<!-- destroy-method="close"> -->
<!-- <property name="driverClassName" value="${jdbc.driverClassName}" /> -->
<!-- <property name="url" value="${jdbc.url}" /> -->
<!-- <property name="username" value="${jdbc.username}" /> -->
<!-- <property name="password" value="${jdbc.password}" /> -->
<!-- <property name="initialSize" value="20" /> -->
<!-- <property name="maxActive" value="80" /> -->
<!-- <property name="maxIdle" value="100" /> -->
<!-- <property name="minIdle" value="20" /> -->
<!-- <property name="validationQuery" value="SELECT COUNT(*) FROM DUAL"></property> -->
<!-- <property name="testOnBorrow" value="true"></property> -->
<!-- <property name="testOnReturn" value="true"></property> -->
<!-- <property name="testWhileIdle" value="true"></property> -->
<!-- </bean> --> <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="ds1" />
<!-- <property name="xaDataSourceClassName" value="${jdbc.driverClassName}" /> -->
<property name="xaDataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />
<property name="xaProperties">
<props>
<prop key="URL">${jdbc.url}</prop>
<prop key="user">${jdbc.username}</prop>
<prop key="password">${jdbc.password}</prop>
</props>
</property>
<!-- #连接池中保留的最小连接数 -->
<property name="minPoolSize" value="5" />
<!-- #连接池中保留的最大连接数 -->
<property name="maxPoolSize" value="20" />
<!-- #最大空暇时间,60秒内未使用则连接被丢弃。 若为0则永不丢弃。 Default: -->
<property name="maxIdleTime" value="60" />
<property name="testQuery">
<value>select 1</value>
</property>
</bean> <!-- JNDI连接池 -->
<!-- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> -->
<!-- <property name="jndiName"> -->
<!-- <value>java:comp/env/jdbc/huiyzl</value> -->
<!-- </property> -->
<!-- </bean> --> <!-- 配置SqlSessionFactoryBean -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- mapper和resultmap配置路径 -->
<property name="mapperLocations">
<list>
<!-- 注意classpath后面的星号不可省略,否则不能载入jar包中的xml文件 -->
<value>classpath*:com/hvgroup/zhuhai10086/jms/**/sql/mysql/*Mapper.xml
</value>
</list>
</property>
<property name="plugins">
<array>
<!-- 关于分页插件的使用说明:http://git.oschina.net/free/Mybatis_PageHelper/blob/master/wikis/HowToUse.markdown -->
<bean class="com.github.pagehelper.PageHelper">
<property name="properties">
<value>
offsetAsPageNum=true
rowBoundsWithCount=true
reasonable=true
</value>
</property>
</bean>
</array>
</property>
</bean> <!-- 事务管理 -->
<!-- <bean id="transactionManager" -->
<!-- class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> -->
<!-- <property name="dataSource" ref="dataSource" /> -->
<!-- </bean> --> <!-- MapperScanner配置,Spring 自己主动去搜索mapper里的对象,并注入。指定markerInterface表示仅仅有继承SqlMapper接口的接口,才会被扫描映射 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.hvgroup.zhuhai10086.jms.**.mapper" />
<property name="markerInterface" value="com.hvgroup.zhuhai10086.jms.mapper.SqlMapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean> <bean id="userTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp"
init-method="init" destroy-method="shutdownForce">
<constructor-arg>
<props>
<prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop>
</props>
</constructor-arg>
</bean> <bean id="atomikosTransactionManager"
class="com.atomikos.icatch.jta.UserTransactionManager"
depends-on="userTransactionService"
init-method="init" destroy-method="close" >
<property name="forceShutdown" value="false"/>
</bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp" >
<property name="transactionTimeout" value="300"/>
</bean> <!-- 分布式事务 -->
<bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="atomikosTransactionManager"/>
<property name="userTransaction" ref="atomikosUserTransaction"/>
</bean> <!-- <tx:jta-transaction-manager /> -->
<!-- 可通过注解控制事务。也能够配置拦截器方式配置事务 -->
<tx:annotation-driven transaction-manager="jtaTransactionManager" /> </beans>

3、ActiveMQ-XA.xml

<?

xml version="1.0" encoding="GBK"?>
<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"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:jms="http://www.springframework.org/schema/jms"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/jms
http://www.springframework.org/schema/jms/spring-jms-4.1.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.13.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.1.xsd"> <!-- 重发策略:最多重发次数=maximumRedeliveries -->
<amq:redeliveryPolicy id="redeliveryPolicy"
maximumRedeliveries="6" /> <!-- 抓取策略 -->
<amq:prefetchPolicy id="prefetchPolicy" queuePrefetch="5" topicPrefetch="5" /> <!-- activeMQ连接信息,XA事务 -->
<amq:xaConnectionFactory id="jmsXaConnectionFactory"
brokerURL="${activemq.brokerURL}"
userName="${activemq.username}"
password="${activemq.password}"
redeliveryPolicy="#redeliveryPolicy"
alwaysSessionAsync="false"
alwaysSyncSend="true"
prefetchPolicy="#prefetchPolicy"/> <bean id="amqConnectionFactory"
class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="XAactiveMQ"/>
<property name="xaConnectionFactory" ref="jmsXaConnectionFactory"/>
<property name="poolSize" value="100"/>
</bean> <!-- ====Producer side start==== --> <!-- 定义JmsTemplate的Queue类型 -->
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
<constructor-arg ref="amqConnectionFactory" />
<!-- 非pub/sub模型(公布/订阅)。即队列模式 -->
<property name="pubSubDomain" value="false" />
</bean> <!-- 定义JmsTemplate的Topic类型 -->
<bean id="jmsTopicTemplate" class="org.springframework.jms.core.JmsTemplate">
<constructor-arg ref="amqConnectionFactory" />
<!-- pub/sub模型(公布/订阅) -->
<property name="pubSubDomain" value="true" />
</bean> <!-- ====Producer side end==== --> <!-- ====Consumer side start==== --> <!--这个是sessionAwareQueue目的地(响应消息)-->
<amq:queue id="queueReceiver2ResponseDestination" physicalName="test.queue2.response" /> <!-- 定义Queue监听器(无事务) -->
<jms:listener-container
destination-type="queue"
container-type="default"
connection-factory="amqConnectionFactory"
error-handler="jmsErrorHandler"
acknowledge="auto">
<jms:listener destination="xinge.queue.push" ref="xgMessageReceiver" concurrency="5-100" />
<jms:listener destination="xinge.queue.push.device.multiple" ref="xgMessageReceiverMultiple" concurrency="5-100" />
</jms:listener-container> <!-- 定义Queue监听器(有事务) -->
<jms:listener-container
destination-type="queue"
container-type="default"
connection-factory="amqConnectionFactory"
transaction-manager="jtaTransactionManager"
error-handler="jmsErrorHandler"
acknowledge="transacted">
<jms:listener destination="xinge.queue.push.invokelog" ref="xgMessageReceiverInvokeLog" concurrency="5-100" />
<!-- <jms:listener destination="test.queue" ref="queueReceiver" concurrency="10-100" /> -->
<!-- <jms:listener destination="test.queue2" ref="queueReceiver2" concurrency="2-10"/> -->
<!-- <jms:listener destination="test.queue2.response" ref="queueReceiver2Response" concurrency="2-10" /> -->
</jms:listener-container> <!-- 定义Topic监听器 -->
<!-- <jms:listener-container -->
<!-- destination-type="topic" -->
<!-- container-type="default" -->
<!-- connection-factory="amqConnectionFactory" -->
<!-- transaction-manager="jtaTransactionManager" -->
<!-- error-handler="jmsErrorHandler" -->
<!-- acknowledge="transacted" > -->
<!-- <jms:listener destination="test.topic" ref="topicReceiver" /> -->
<!-- <jms:listener destination="test.topic" ref="topicReceiver2" /> -->
<!-- </jms:listener-container> --> <!-- ====Consumer side end==== --> <bean id="xingeApp" class="com.tencent.xinge.XingeApp">
<constructor-arg index="0" value="2100170086"/><!-- accessId -->
<constructor-arg index="1" value="2d257b10220bc3849743ffe0e9bd233a"/><!-- secretKey -->
</bean> </beans>

4、spring-mvc.xml

<?

xml version="1.0" encoding="GBK"?

>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"> <!-- 启用MVC注解 -->
<mvc:annotation-driven /> <!-- 静态资源文件。不会被Spring MVC拦截 -->
<mvc:resources location="/resources/" mapping="/resources/**"/> <!-- 指定Sping组件扫描的基本包路径 -->
<context:component-scan base-package="com.hvgroup.zhuhai10086.jms" >
<!-- 这里仅仅扫描Controller,不可反复载入Service -->
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan> <!-- JSP视图解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
<property name="order" value="1" />
</bean> </beans>

5、config.properties

jdbc.url=jdbc:mysql://localhost:3306/xgmessage?useUnicode=true&amp;characterEncoding=utf-8&amp;relaxAutoCommit=true
jdbc.username=root
jdbc.password=123456 activemq.brokerURL=tcp://localhost:61616
activemq.username=admin
activemq.password=admin

6、web.xml

<?xml version="1.0" encoding="UTF-8"?

>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:web="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>zhuhai10086-jms</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>zhuhai10086-jms</param-value>
</context-param>
<!-- Log4j配置 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j/log4j.xml</param-value>
</context-param>
<!-- 载入log4j配置文件 -->
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<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>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring/applicationContext.xml,classpath*:activemq/ActiveMQ-XA.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

7、把log4j.xml 也贴出来吧,后续有的同学能用上

<?

xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
<log4j:configuration debug="true" xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d][%p][%13F:%L] %m%n" />
</layout>
</appender>
<appender name="DEBUG" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${log4j.logfile.path}" />
<param name="Encoding" value="UTF-8" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="ImmediateFlush" value="true" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d][%p] %m%n" />
</layout>
</appender> <logger name="java.sql.Connection">
<level value="DEBUG" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="java.sql.PreparedStatement">
<level value="DEBUG" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="java.sql.Statement">
<level value="DEBUG" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="java.sql.ResultSet">
<level value="DEBUG" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="org.mybatis">
<level value="DEBUG" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="org.springframework">
<level value="INFO" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="org.apache.ibatis">
<level value="INFO" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="org.apache.xbean.spring">
<level value="INFO" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="com.atomikos">
<level value="ERROR" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger>
<logger name="org.apache.activemq">
<level value="INFO" />
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger> <logger name="com.hvgroup">
<level value="DEBUG"/>
<appender-ref ref="DEBUG" />
<appender-ref ref="CONSOLE" />
</logger> <!-- Root Logger -->
<root>
<level value="DEBUG"/>
</root> </log4j:configuration>

对须要使用数据库数据源的方法使用 @Transactional 注解就可以,在配置上,JMS的事务我们已经在配置文件里指定了。例如以下代码中指定的 transaction-manager=”jtaTransactionManager”:

    <!-- 定义Queue监听器(有事务) -->
<jms:listener-container
destination-type="queue"
container-type="default"
connection-factory="amqConnectionFactory"
transaction-manager="jtaTransactionManager"
error-handler="jmsErrorHandler"
acknowledge="transacted">
<jms:listener destination="xinge.queue.push.invokelog" ref="xgMessageReceiverInvokeLog" concurrency="5-100" />
</jms:listener-container>

最后贴上project代码的结构图:

声明:本文是我在项目实际业务开发之前搭建的框架,当中如出现一些敏感字。声明不涉及版权问题。

贴出的配置。仅供大家学习。

SpringMVC+MyBatis+JMS+JTA(分布式事务)的更多相关文章

  1. Springboot+Atomikos+Jpa+Mysql实现JTA分布式事务

    1 前言 之前整理了一个spring+jotm实现的分布式事务实现,但是听说spring3.X后不再支持jotm了,jotm也有好几年没更新了,所以今天整理springboot+Atomikos+jp ...

  2. 使用Atomikos Transactions Essentials实现多数据源JTA分布式事务--转载

    原文:http://www.ite/topic/122700 9.17 update:使用NonXADataSourceBean. Mysql在5.0版本和Connecter/J5.0版本后提供了XA ...

  3. 事务隔离级别与传播机制,spring+mybatis+atomikos实现分布式事务管理

    1.事务的定义:事务是指多个操作单元组成的合集,多个单元操作是整体不可分割的,要么都操作不成功,要么都成功.其必须遵循四个原则(ACID). 原子性(Atomicity):即事务是不可分割的最小工作单 ...

  4. Spring事务隔离级别与传播机制详解,spring+mybatis+atomikos实现分布式事务管理

    原创说明:本文为本人原创作品,绝非他处转载,转账请注明出处 1.事务的定义:事务是指多个操作单元组成的合集,多个单元操作是整体不可分割的,要么都操作不成功,要么都成功.其必须遵循四个原则(ACID). ...

  5. JTA 分布式事务

    什么是JTA - 2009-07-25 18:31:06|  分类: 技术文章|举报|字号 订阅     什么是JTA? Java Transaction API(Java事务API) (JTA)Ja ...

  6. Spring 3.0 + Atomikos构建jta分布式事务

    Spring3.0已经不再支持jtom了,不过我们可以用第三方开源软件atomikos(http://www.atomikos.com/)来实现.Atomikos是目前在分布式事务管理中做得相当不错的 ...

  7. j2ee分布式架构 dubbo + springmvc + mybatis + ehcache + redis 分布式架构

    介绍 <modules>        <!-- jeesz 工具jar -->        <module>jeesz-utils</module> ...

  8. spring+jotm+ibatis+mysql实现JTA分布式事务

    1 环境 1.1 软件环境  spring-framework-2.5.6.SEC01-with-dependencies.zip ibatis-2.3.4 ow2-jotm-dist-2.1.4-b ...

  9. Springboot + Atomikos + Druid + Mysql 实现JTA分布式事务

    DataSource 配置 package com.cheng.dynamic.config; import java.util.Properties; import javax.sql.DataSo ...

随机推荐

  1. 树莓派搭建Seafile个人网盘

    步骤一.安装Seafile依赖包 yum install python-setuptools python-ldap python-memcached MySQL-python mariadb mar ...

  2. 南邮CTF--bypass again

    南邮CTF--bypass again 提示:依旧弱类型,来源hctf 解析: 源代码: if (isset($_GET['a']) and isset($_GET['b'])) {​ if ($_G ...

  3. LeetCode(73)Set Matrix Zeroes

    题目 Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. cli ...

  4. linux中的grep命令用法

    原文请移驾:http://blog.csdn.net/greytree/article/details/428532 grep -- print lines matching a pattern (将 ...

  5. java环境配置——工具下载地址

    每次官网找个下载地址都是 费劲巴拉的 整理了一下几个下载地址分享给大家 eclipse:http://www.eclipse.org/downloads/packages/release/Kepler ...

  6. SSH常见问题集锦

    /WEB-INF/web.xml Web应用程序配置文件,描述了 servlet 和其他的应用组件配置及命名规则. /WEB-INF/classes/包含了站点所有用的 class 文件,包括 ser ...

  7. POJ-2773 Happy 2006,暴力2700ms+水过!

                                                         Happy 2006 这个题很可能会超时的,但我几乎暴力的方法2700ms+过了,可能是后台水 ...

  8. NIUDAY 11.23 北京站抢票啦 | 看 AI 落地行业 享 AI 时代红利

    2018 年是见证「奇迹」的一年.AI 从多年的热门话题中开始走下神坛,逐渐深入到了各个行业,加速经济结构优化及行业智慧化升级,AI 已不再是难以企及的神话而是可触摸的美好未来. 政策支持加上资本推动 ...

  9. Codeforces947D. Picking Strings

    $n \leq 100000,m \leq 100000$,给长度$n$的字符串$s$和$m$的字符串$t$,只含ABC.定义串$a$可以经过任意次如下操作变成其他串. 现在$q \leq 10000 ...

  10. linux上配置spark集群

    环境: linux spark1.6.0 hadoop2.2.0 一.安装scala(每台机器)   1.下载scala-2.11.0.tgz   放在目录: /opt下,tar -zxvf scal ...