Monthly Archives: กันยายน 2015

spring @Async

1. Overview In this article we’ll explore the asynchronous execution support in Spring – and the @Async annotation. Simply put – annotating a method of a bean with @Async will make it execute in a separate thread i.e. the caller will not wait … Continue reading

Posted in java | Leave a comment

spring jeditCluster

import redis.clients.jedis.JedisCluster; Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>(); //Jedis Cluster will attempt to discover cluster nodes automatically jedisClusterNodes.add(new HostAndPort("", 6387)); jedisClusterNodes.add(new HostAndPort("", 6388)); jedisClusterNodes.add(new HostAndPort("", 6389)); jedisCluster = new JedisCluster(jedisClusterNodes); jedisCluster.set(key,value); jedisCluster.setex(key,expires,value); jedisCluster.get(key); jedisCluster.del(key);

Posted in java, redis | Leave a comment

corner ribbon

Posted in knowledge | Leave a comment

java sha1 equivalent to php

 public String sha1(String data) {         try {             // Create MD5 Hash             MessageDigest digest ="SHA-1");             digest.update(data.getBytes("UTF-8"));     … Continue reading

Posted in java | Leave a comment

spring use utf-8 in resource properties ใช้ภาษาไทยในไฟล์พร็อพเพอร์ตี้ @Service public class SomeServiceImpl implements SomeService { @Autowired Environment env;    public String test(Map<String,String> inputvalidate)  {        return env.getProperty("").getBytes("ISO-8859-1"), "UTF-8")   } }

Posted in java, spring boot | Leave a comment