Skip to content

Instantly share code, notes, and snippets.

View keesun's full-sized avatar
📺
On Air

Keesun Baik (a.k.a, Whiteship) keesun

📺
On Air
View GitHub Profile
@keesun
keesun / AppConfig.java
Created January 18, 2012 15:36
Spring 3.1's Configurer Pattern
@Configuration
@EnableHello
public class AppConfig implements NameConfigurer {
@Override
public void configure(Hello hello) {
hello.setName("Thank you very much, Toby.");
}
}
@keesun
keesun / EnableHello.java
Created January 18, 2012 15:18
Spring 3.1's @import & ImportBeanDefinitionRegistrar
@Retention(value = RetentionPolicy.RUNTIME)
@Import(HeloIBDR.class)
public @interface EnableHello {
String name();
}
@keesun
keesun / AppConfig.java
Created January 18, 2012 14:30
Spring 3.1's @import & ImportSelector
@Configuration
@EnableHello(type = "korean", name = "Keesun")
public class AppConfig {
}
@keesun
keesun / AppConfig.java
Created January 18, 2012 14:13
Spring 3.1's @import, @enable and ImportAware
@Configuration
@EnableHello(name = "Keesun")
public class AppConfig {
}
@keesun
keesun / AppConfig.java
Created January 18, 2012 14:09
Spring 3.1's @import & @enable
@Configuration
@EnableHello
public class AppConfig {
}
@keesun
keesun / AppConfig.java
Created January 18, 2012 14:05
Spring 3.1's @import
@Configuration
@Import(HelloConfig.class)
public class AppConfig {
@Override
public Hello hello() {
Hello h = super.hello();
h.setName("Keesun");
return h;
}
}
@keesun
keesun / AppConfig.java
Created January 18, 2012 13:57
Spring 3.1's extends @configuration
@Configuration
public class AppConfig extends HelloConfig {
@Override
public Hello hello() {
Hello h = super.hello();
h.setName("Keesun");
return h;
}
}
@keesun
keesun / AppConfig.java
Created January 18, 2012 13:36
Spring 3.1's TestContext
package sandbox.testcontext.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Keesun Baik
*/
@Configuration
public class AppConfig {
@keesun
keesun / AsyncServlet.java
Created January 16, 2012 16:32
Servlet 3.0's Asynchronous Support sample
package me.whiteship.board.modules.servlet.async;
import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@keesun
keesun / FileUploadServlet.java
Created January 13, 2012 03:19
Servlet 3.0's FileUpload Sample
@WebServlet("/upload")
@MultipartConfig(location = "/tmp")
public class FileUploadServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
getServletContext().getRequestDispatcher("/WEB-INF/views/fileUpload.jsp").forward(req, res);
}
@Override