Code Snippet
文章平均质量分 59
ppby2002
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HttpClientTest
public class HttpClientTest { public static void main(String[] args) throws Exception { test1(); } public static void test1() throws Exception { String url = "http://121.199.26.12:8080/mg原创 2014-02-10 17:34:43 · 810 阅读 · 0 评论 -
Spring Controller Junit例子
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring/context-test.xml" }) public abstract class BaseRuleTest extends AbstractTransactionalJUnit4SpringContext原创 2014-02-10 13:57:18 · 3293 阅读 · 0 评论 -
Post Json 例子 Spring Rest Template & HttpClient
package com.lee; import static java.lang.System.out; import java.io.Serializable; import java.io.StringWriter; import org.apache.http.Consts; import org.apache.http.HttpResponse; imp原创 2014-03-13 12:04:35 · 7090 阅读 · 1 评论 -
Logging Intercepter例子
protected void logInputMessage(JoinPoint jp, Method method) { boolean mdc = false; try { InputLog ann = (InputLog) method.getAnnotation(InputLog.class); if ((ann != null) && (!(ArrayUtils.isEm原创 2014-02-10 13:48:13 · 845 阅读 · 0 评论 -
Log Annonation例子
@Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface InputLog { LogLevel value() default LogLevel.INFO; String prefix() default ""; } @Docum原创 2014-03-07 15:07:53 · 781 阅读 · 0 评论 -
Spring Annonation 的例子
Spring Request/Response Annnonation @ResponseBody @RequestBody原创 2014-02-10 13:45:43 · 1067 阅读 · 0 评论 -
通用函数
public final class CommonUtils { public static int getSize(Map t) { return t == null ? 0 : t.size(); } public static int getSize(Hashtable t) { return t == nul原创 2014-04-29 17:23:29 · 687 阅读 · 0 评论 -
Spring MVC 的 异常处理
@Controller public class ExceptionHandler { @ExceptionHandler(Exception.class) @ResponseStatus(value = HttpStatus.NOT_FOUND) @ResponseBody public ErrorMessage handleResourceNotFou原创 2014-03-20 09:39:36 · 635 阅读 · 0 评论 -
MyBatis Mapper 文件例子
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> select user_name userName from user_table where user_id = #{userId} ]]> --> SELECT原创 2014-03-06 11:15:29 · 11630 阅读 · 0 评论 -
csv macro
Option Explicit Const DB_COLUMN_ROW As Integer = 1 Const DB_DATA_ROW As Integer = 3 Const DB_START_COLUMN As Integer = 1 Sub ExportCsv() On Error GoTo ERR_LINE Dim columnIn原创 2014-04-18 14:53:45 · 611 阅读 · 0 评论 -
Java 连接 Access
public class AccessTest { private final static String MDB_FILE = "C:\\test\TestDB.accdb"; public static void main(String[] args) throws Exception { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver原创 2014-05-14 16:42:37 · 702 阅读 · 0 评论 -
Logback 配置文件例子
%d %-5level %logger{80} - %msg %n true --> \${user.home}/logs/hk_retail_out.log \${user.home}/logs/hk_retail_out.%i.log.zip 1 3 2MB %date [%X{flow}] %-5level %X{ip} %logger{80}原创 2014-02-10 13:50:35 · 8536 阅读 · 1 评论 -
有用的Maven dependency
org.hibernate hibernate-validator 4.3.1.Final org.codehaus.jackson jackson-mapper-asl 1.9.10 org.mybatis mybatis-spring 1.1.1 spring-tx org.spri原创 2014-03-05 14:50:46 · 1027 阅读 · 0 评论 -
spring context 例子
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:c="http://www.springframework.org/schema/c" xmlns:cache="http://www.springfra原创 2014-03-05 13:51:46 · 1061 阅读 · 0 评论 -
RestTemplate 例子
public class RestClient { private static final RestTemplate temp = new RestTemplate(); private static void validateDeal() throws Exception { HttpEntity entity = ClientHelp原创 2014-02-24 17:01:19 · 5106 阅读 · 0 评论 -
VB.NET 从main函数里启动窗口
_ Public Shared Sub Main() Application.EnableVisualStyles() Application.Run(New Form1()) End Sub原创 2014-02-12 17:08:49 · 8491 阅读 · 1 评论 -
ehcache config xml file
overflowToDisk="false" memoryStoreEvictionPolicy="LFU" /> name="MyCache" maxElementsInMemory="200" eternal="false" timeToLiveSeconds="600" overflowToDisk="false"/>原创 2014-02-25 16:19:55 · 1080 阅读 · 0 评论 -
Doc App WebService
public interface ActivityRender { public void onRequestSuccess(JSONObject json); public void onRequestFailed(int status, String msg); public void onRequestException(Exception e); } pu原创 2014-02-11 17:36:39 · 1053 阅读 · 0 评论 -
Spring 自定义json converter
public class MyJacksonObjectMapper extends ObjectMapper { public MyJacksonObjectMapper() { CustomSerializerFactory factory = new CustomSerializerFactory(); factory.addSpecificMapping(Date.class, ne原创 2014-02-13 17:07:10 · 2108 阅读 · 0 评论 -
Log Mask
public class MaskedReflectionToStringBuilder extends ReflectionToStringBuilder { @Override protected Object getValue(Field field) throws IllegalArgumentException, IllegalAccessException {原创 2014-02-27 09:15:52 · 2169 阅读 · 0 评论 -
Tomcat 相关配置
引用其它目录下的web工程 在server.xml中添加 " path="/" reloadable="true"/>原创 2014-02-27 11:12:32 · 782 阅读 · 0 评论 -
Json Converter例子
public final class JsonConverter { @SuppressWarnings("unchecked") public static T convert(MvcResult result, TypeReference ref) throws Exception{ ObjectMapper mapper = createMapp原创 2014-02-24 16:45:17 · 2213 阅读 · 0 评论 -
Json api doc Controller例子
@Controller @RequestMapping(value = "/jsondoc") public class JSONDocController { private final static Logger log = LoggerFactory.getLogger(JSONDocController.class); @Autowired(required=false) p原创 2014-02-28 14:58:42 · 2771 阅读 · 0 评论 -
spring mvc web.xml 例子
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原创 2014-03-05 11:45:54 · 1324 阅读 · 0 评论 -
Log Annonation例子
@Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD}) public @interface LogIgnore { } @Documented @Retention(RetentionPolicy原创 2014-03-06 10:08:42 · 863 阅读 · 0 评论 -
native2ascii插件配置
native2ascii插件 org.codehaus.mojo native2ascii-maven-plugin 1.0-beta-1 UTF-8 src/main/resources/${message.dir.rel} ${outputDirectory}/${message.dir.rel} **/*.properties native2asc原创 2014-05-19 09:39:08 · 2737 阅读 · 0 评论
分享