Skip to main content

Posts

Showing posts from February, 2013

Spring MVC 3.2 Preview: Introducing Servlet 3, Async Support

Continuing the Spring 3.0 "simplification series" started by Keith and Chris , I would like to provide a quick overview of simplifications in scheduling and task execution enabled by Spring 3.0. I will be walking through a basic sample application that you can checkout from the spring-samples Subversion repository. It has been designed to be as simple as possible while showcasing both annotation-driven and XML-based approaches to scheduling tasks in Spring 3.0. Let's begin with the annotation-driven approach. You can run it directly via the main() method in AnnotationDemo. If you take a look, you'll see that it's nothing more than a bootstrap for a Spring ApplicationContext: public static void main(String[] args) {      new ClassPathXmlApplicationContext( "config.xml" , AnnotationDemo. class ); } The reason nothing else is necessary is that the ApplicationContext contains an "active" component, which we will...

Apache Camel 框架集成Spring

Apache Camel提供了和Spring的集成,通过Spring容器(ApplicationContext)来管理Camel的CamelContext,这样的话,就不需要写代码来控制CamelContext的初始化,启动和停止了.Camel会随着Spring的启动而启动起来. 本文将Apache Camel框架入门示例(http://blog.csdn.net/kkdelta/article/details/7231640)中的例子集成到Spring中,下面简单介绍一下集成的基本步骤. 1,新建一个Eclipse工程,将Spring3的jar包,和Camel的jar包配置到工程的classpath. 2,Route类要继承RouteBuilde,如下 1 public   class   FileProcessWithCamelSpring  extends   RouteBuilder { 2      @Override 3      public   void   configure()  throws   Exception { 4          FileConvertProcessor processor =  new   FileConvertProcessor(); 5          from( "file:d:/temp/inbox?delay=30000" ).process(processor).to( "file:d:/temp/outbox" );        6      } 7 } 3,Processor仍然和和入门示例的代码相同. 01 public   ...