Job Scheduling Support
Most nontrivial applications require some kind of scheduling capability. Whether this is for sending
updates to customers or performing housekeeping tasks, the ability to schedule code to run at a
predefined point in time is an invaluable tool for developers.
Spring provides its own scheduling support that can fulfill most common scenarios. A task can be
scheduled either for a fixed interval or by using a Unix cron expression.
On the other hand, for task execution and scheduling, Spring integrates with other scheduling
libraries as well. For example, in the application server environment, Spring can delegate the execution to
the CommonJ library being used by many commonly used application servers. For job scheduling, Spring
also supports libraries including the JDK Timer API and Quartz, a commonly used open source
scheduling library.
The scheduling support in Spring is covered in full in Chapter 15.
Dynamic Scripting Support
Starting from JDK 6, Java had introduced the dynamic language support, in which you can execute
scripts written in other languages in a JVM environment. Examples include Groovy, JRuby, JavaScript,
and so on.
Spring also supports the execution of dynamic scripts in a Spring powered application, or you can
define a Spring bean that was written in a dynamic scripting language and injected into other JavaBeans.
Spring supported dynamic scripting languages include Groovy, JRuby, and BeanShell. In Chapter 22, we
will discuss the support of dynamic scripting in Spring in detail.
Simplified Exception Handling
One area where Spring really helps reduce the amount of repetitive, boilerplate code you need to write is
in exception handling. The core of the Spring philosophy in this respect is that checked exceptions are
overused in Java and that a framework should not force you to catch any exception from which you are
unlikely to be able to recover--a point of view that we agree with wholeheartedly.
In reality, many frameworks are designed to reduce the impact of having to write code to handle
checked exceptions. However, many of these frameworks take the approach of sticking with checked
exceptions but artificially reducing the granularity of the exception class hierarchy. One thing you will
notice with Spring is that because of the convenience afforded to the developer from using unchecked
exceptions, the exception hierarchy is remarkably granular.
Throughout the topic you will see examples of where the Spring exception handling mechanisms
can reduce the amount of code you have to write and, at the same time, improve your ability to
identify, classify, and diagnose errors within your application.
The Spring Project
One of the most endearing things about the Spring project is the level of activity currently present in
the community and the amount of cross-pollination between other projects such as CGLIB, Apache
Geronimo, and AspectJ. One of the most touted benefits of open source is that if the project folded
tomorrow, you would be left with the code; but let's face it--you do not want to be left with a codebase
the size of Spring to support and improve upon. For this reason, it is comforting to know how well
established and active the Spring community is.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home