Skip to content

Instantly share code, notes, and snippets.

@zzzfree
zzzfree / gist:5106203
Created March 7, 2013 07:27
MapQueue
class MapQueue {
def max=0
def last=0
def c = [:]
def q = []
def MapQueue(m){
max=m
}
@zzzfree
zzzfree / ImageResize.groovy
Last active December 14, 2015 15:09
ImageResize
import javax.swing.ImageIcon
import java.awt.Color
import java.awt.image.BufferedImage
import java.awt.image.ColorModel
import java.awt.image.WritableRaster
import java.awt.Graphics2D
import javax.imageio.*
import java.awt.*
Jsp中处理:
<%
//第三种方式
ServletContext servletContext = request.getSession().getServletContext();
ApplicationContext ctx=WebApplicationContextUtils.getWebApplicationContext(servletContext);
在web.xml中配置
配置监听器:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
@zzzfree
zzzfree / gist:5060808
Last active December 14, 2015 08:49
appliation bean
import org.springframework.context.ApplicationContext
import org.springframework.context.support.FileSystemXmlApplicationContext
class BeanUtil {
ApplicationContext context=new FileSystemXmlApplicationContext("classpath:applicationContext.xml");
static instance = new BeanUtil();
public Object get(Object s) {
public static WebApplicationContext getCurrentWebApplicationContext() {
return (WebApplicationContext) currentContextPerThread.get(Thread.currentThread().getContextClassLoader());
}