Spring Framework : A Framework from SpringSource :: Spring with J2EE
What is Remoting? |
Spring provides integration classes for remoting support using various technologies. The remoting support eases the development of remote-enabled services, implemented by (Spring) POJOs. Currently, Spring supports following remoting technologies:
- RMI (Remote Method Invocation): Through the use of the RmiProxyFactoryBean and the RmiServiceExporter Spring supports both traditional RMI (with java.rmi.Remote interfaces and java.rmi.RemoteException) and transparent remoting by RMI invokers (with any Java interface).
- Spring’s HTTP invoker : Spring provides a special remoting strategy which allows for Java serialization by HTTP, supporting any Java interface (just like the RMI invoker). The corresponding support classes are HttpInvokerProxyFactoryBean and HttpInvokerServiceExporter.
- Hessian : By using the HessianProxyFactoryBean and the HessianServiceExporter you can transparently expose your services using the lightweight binary HTTP-based protocol provided by Caucho.
- Burlap : Burlap is Caucho’s XML-based alternative for Hessian. Spring provides support classes such as BurlapProxyFactoryBean and BurlapServiceExporter.
- JAX RPC : Spring provides remoting support for Web services via JAX-RPC.
- JMS(Java Message Service) : Remoting using JMS as the underlying protocol is supported via the JmsInvokerServiceExporter and JmsInvokerProxyFactoryBean classes.
Supports of EJB, JMS, JMX, and Emails with Spring |
EJB
Spring is often considered an EJB replacement. You do believe that for many if not most applications and use cases, Spring as a container, combined with its rich supporting functionality in the area of transactions, ORM and JDBC access, is a better choice than implementing equivalent functionality via an EJB container and EJBs.
However, it is important to note that using Spring does not prevent you from using EJBs. In fact, Spring makes it much easier to access EJBs and implement EJBs and functionality within them. Additionally, using Spring to access services provided by EJBs allows the implementation of those services to later transparently be switched between local EJB, remote EJB, or POJO (plain old Java object) variants, without the client code having to be changed.
JMS
Spring provides a JMS abstraction framework that simplifies the use of the JMS API.
JMS can be roughly divided into two areas of functionality, namely the production and consumption of messages.
The JmsTemplate class is used for message production and synchronous message reception.
- The package org.springframework.jms.core – provides the core functionality for using JMS. It contains JMS template classes that simplifies the use of the JMS by handling the creation and release of resources, much like the JdbcTemplate does for JDBC. The JMS template follows the same design. The classes offer various convenience methods for the sending of messages, consuming a message synchronously, and exposing the JMS session and message producer to the user.
- The package org.springframework.jms.support – provides JMSException translation functionality.
- The package org.springframework.jms.support.converter – provides aMessageConverter abstraction to convert between Java objects and JMS messages.
- The package org.springframework.jms.support.destination – provides various strategies for managing JMS destinations, such as providing a service locator for destinations stored in JNDI.
-
Finally, the package org.springframework.jms.connection – provides an implementation of the ConnectionFactory suitable for use in standalone applications. It also contains an implementation of Spring’s PlatformTransactionManager for JMS. (the JmsTransactionManager). This allows for seamless integration of JMS as a transactional resource into Spring’s transaction management mechanisms.
JMX
The JMX support in Spring provides you with the features to easily and transparently integrate your Spring application into a JMX infrastructure. Spring’s JMX support provides four core features:
- The automatic registration of any Spring bean as a JMX MBean
- A flexible mechanism for controlling the management interface of your beans
- The declarative exposure of MBeans over remote, JSR-160 connectors
- The simple proxying of both local and remote MBean resources
Scheduling
The Spring Framework features integration classes for scheduling support. Currently, Spring supports the Timer, part of the JDK since 1.3, and the Quartz Scheduler (http://www.opensymphony.com/quartz/). Both schedulers are set up using a FactoryBean with optional references to Timer or Trigger instances, respectively.
Spring also features classes for thread pooling that abstract away differences between Java 1.3, 1.4, 5 and JEE environments.
Emails
The Spring Framework provides a helpful utility library for sending email.
The org.springframework.mail package is the root level package for the Spring Framework’s email support.
The central interface for sending emails is the MailSender interface; a simple value object encapsulating the properties of a simple mail such as from and to (plus many others) is the SimpleMailMessage class.
The org.springframework.mail.javamail.JavaMailSender interface adds specialized JavaMail features such as MIME message support to the MailSender interface (from which it inherits).
JavaMailSender also provides a callback interface for preparation of JavaMail MIME messages, called org.springframework.mail.javamail.MimeMessagePreparator.
Click Below to download the Examples
Recent Comments