Archive for February, 2009

Feb 26 2009

Sending email with Spring and Velocity

Published by Gilles under J2EE, Java, Programming, Spring

spring25.png velocity-logo.png

I’ll try to explain how it can be easy to create an email service class that uses and to send mails.
First of all, what do you need in your classpath?

  • activation.jar
  • mail.jar
  • spring.jar
  • velocity.jar

I’m using 2.5 and 1.5.

Pages: 1 2 3 4 5 6 7

One response so far

Feb 17 2009

Accessing Spring application context in MDB’s

Published by Gilles under J2EE, Java, Spring

spring25.png
Let’s say you have a message driven bean in which you want to inject beans.

Add an interceptor

Annotate your with the @Interceptors and specify SpringBeanAutowiringInterceptor.class as interceptor. This is an 3-compliant interceptor class that injects beans into fields and methods which are annotated with @Autowired. Performs injection after construction as well as after activation of a passivated bean.
The actual BeanFactory to obtain beans from is determined by the getBeanFactory(.lang.Object) template method. The default implementation obtains the ContextSingletonBeanFactoryLocator, initialized from the default resource location classpath*:beanRefContext.xml, and obtains the single ApplicationContext defined there.
(for more info, see doc)

Pages: 1 2 3

No responses yet

Feb 16 2009

Spring annotations based config

Published by Gilles under J2EE, Java, Spring

spring25.png

It is now possible to configure Spring’s dependency injection with annotations. This means that annotations can be used in Spring to mark fields, methods and classes that need dependency injection. Spring also supports auto-wiring of the bean dependencie. Annotations can also be used to indicate fields that are to be auto-wired. Furthermore, auto-detection of annotated components in the classpath is also supported now. When these capabilities are combined, the amount of configuration and dependency mapping in the configuration files is reduced drastically.

Pages: 1 2 3 4 5

No responses yet

Feb 16 2009

Exposing MBeans with Spring

Published by Gilles under J2EE, Java, Spring

spring25.png
Spring could be an alternative to expose Mbeans (see doc).
The support in Spring provides you with the features to easily and transparently integrate application into a infrastructure.

Specifically, ’s support provides four core features:

  • The automatic registration of any bean as a 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

Pages: 1 2 3 4 5

4 responses so far