Skip to content

Instantly share code, notes, and snippets.

View izerui's full-sized avatar
🌍
On vacation

izerui izerui

🌍
On vacation
  • 10:41 (UTC -12:00)
View GitHub Profile
@izerui
izerui / gist:2ba85f3ddbf02ebaefb6
Created June 15, 2014 05:09
另类 - 初始化数据脚本 方式
/*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@izerui
izerui / gist:e45565639abd91620d57
Created June 6, 2014 02:52
动态加载 支持通配符的 properties文件
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resolver.getResources("classpath*:application/*.*");
for(Resource resource:resources){
Properties properties = PropertiesLoaderUtils.loadProperties(resource);
//TODO your business
}
@izerui
izerui / gist:7087d3900d9afbcabc34
Created June 6, 2014 02:35
通过applicationContext拿到 ConfigurableEnvironment 执行 属性 的后期更新和过滤
接口 ConfigurableEnvironment
获取方式: ((AbstractEnvironment)applicationContext.getEnvironment()).getPropertySources()

流程相关操作API

开放给业务的方法:

startProcessInstance (String processKey)

userId session中获取 返回的processInstanceId 业务自己保存

<!-- 支持通配符模式获取i18n 配置文件 -->
<bean id="messageSource"
class="com.izerui.framework.common.application.MultipleMessageSource">
<property name="basenames">
<list>
<value>classpath:application/*/messages</value>
</list>
</property>
</bean>
public class UserDao extends BasicHibernateDao<User, String> {
public User getUserByUsername(String username) {
return findUniqueByProperty("username", username);
}
@CacheEvict(value="shiroAuthorizationCache",allEntries=true)
public void saveUser(User entity) {
save(entity);
}
@izerui
izerui / gist:8349323
Created January 10, 2014 09:54
spring ehcahemanager
/**声明了一个名为 persons 的缓存区域,当调用该方法时,Spring 会检查缓存中是否存在 personId 对应的值。*/
@Cacheable("persons")
public Person profile(Long personId) { ... }
/**指定多个缓存区域。Spring 会一个个的检查,一旦某个区域存在指定值时则返回*/
@Cacheable({"persons", "profiles"})
public Person profile(Long personId) { ... }
</code>
</pre>
@izerui
izerui / gist:7177628
Last active December 26, 2015 16:09
activiti explorer rest integration test prj url: https://github.com/izerui/activiti-explorer
package com.izerui.activiti;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;