ITeye博客

2015 年文章归档

共 13 篇文章

初始化spring-test

在 import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.springtestdbunit.DbUnitTestExecutionListener; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework…

2015-12-30 18:19 · Java/Spring、Spring MVC

post json

方法一: public static String doPostJson(String interfaceUrl, Object jsonObject) throws Exception { String encoding = "UTF-8"; String contentType = "application/json"; String requestMethod = "POST"; Gson gson = new Gson(); String stringJson = gson.toJson(jsonObject); StringBuffer result = new StringBuf…

2015-12-30 12:35 · Java

javascript中借用别的类的方法

借用别的类的方法 /** * Created by Administrator on 2015/12/23. */ //====================借用方法=============================== function borrowMethods(borrowFrom,addTo){ var from = borrowFrom.prototype; var to = addTo.prototype; for(m in from){ if(typeof from[m]!="function"){ continue; } to[m] = from[m]; } } /…

2015-12-23 21:58 · JavaScript

Javascript的类与子类创建

声明父类与子类的示例: /** * Created by Administrator on 2015/12/23. */ //声明Rectangle类 function Rectangle(w, h) { this.width = w; this.height = h; } Rectangle.prototype.area = function () { return this.width * this.height; } //父类定义了toString()方法+ Rectangle.prototype.toString = function(){ return "[width:" + th…

2015-11-11 20:45 · JavaScript

右建打开文本编辑器

http://zhidao.baidu.com/link?url=JNzgRxFtj8d7dsOuvRzT025b8r0dvRMNtYp_YExQur_hIJz9Iqm175EZC7FviHD85ocLKvIyTgZTG6Gy9sVvwq 右建打开文本编辑器 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\EmEditor] @="EmEditor" [HKEY_CLASSES_ROOT\*\shell\EmEditor\command] @="c:\\Program Files\\EmEditor\\EmEdi…

2015-09-05 09:01

安装rredis集群

1、先参考 《CentOS下安装rvm、ruby》将ruby安装起来。 2、安装ruby redis工具 gem install redis 3、如果出现以下错误,那么确认一下 《CentOS下安装rvm、ruby》 的第5点是否正常配置 ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/redis-3.2.1.g…

2015-07-22 15:48 · cache/redis

CentOS下安装rvm、ruby

1、安装的工具包 yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison sqlite-devel iconv-devel 2、安装rvm(ruby管理工具) [root@mail ~]# curl -L get.rvm.io | bash -s stable 如果遇到以下错误: Warning, RVM 1.26.0 introduces si…

2015-07-22 09:17 · SYS/linux

maven打包成可执行的jar包(package a runnable jar)

第一步:利用maven-jar-plugin生成当前工程的jar,该jar包包含manifest的main-class和class-path参数。 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPref…

2015-04-23 22:01 · Java

spring的rabbitmq配置

1、applicationContext-base.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="ht…

2015-03-31 17:57 · Java/Spring、Spring MVC · MQ/RabbitMQ

pring 4.x 注解方式配置quartz 2.2.x的集群

首先是pom.xml <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <artifactId>quartz-test</a…

2015-03-26 20:44 · Java/Quartz

自定义ObjectMapper

d import java.io.IOException; import org.apache.commons.lang.time.DateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonTokenId; import com.fasterxml.jackson.databind.DeserializationContext; import com…

2015-03-02 16:57 · Java · Java/Spring、Spring MVC

JsonObjectMapper

import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; /** * json与…

2015-02-05 10:41 · Java

spring 4.x源码方式配置spring beans

public class ZeusWebApplicationInitializer implements WebApplicationInitializer { public void onStartup(ServletContext container) { WebApplicationContext rootContext = WebApplicationContextUtils.getWebApplicationContext(container); if (rootContext == null) { rootContext = new AnnotationConfigWebApp…

2015-01-06 11:58 · Java/Spring、Spring MVC