background preloader

Spring

Facebook Twitter

Spring managed event listeners with JPA « Diving deep into JEE. Hi readers, I wanted to set things right.

Spring managed event listeners with JPA « Diving deep into JEE

I’ve been approximative in a previous post. I wrote an incomplete assertion: “using spring-managed listeners with JPA is not possible“. I want to clarify things: – using spring managed listeners with JPA is not possible if you absolutly want to use JPA interface and ignore the underlying implementation, – if your implementation is hibernate, and depending on hibernate version, your solution may be more or less elegant. 1 – When JPA won’t suit your needs. JPA won’t suit your needs when you need (for many reason) to have control on the listener : the class that executes instructions as a reaction to an event. But even if you cannot provide JPA interfaces with your listeners, you’re not stuck, you can use the underlying implementation. Wunschdenken» Blogarchiv » Spring Properties Reloaded. Some time ago, I promised I would describe how to make spring configuration properties reloadable.

Wunschdenken» Blogarchiv » Spring Properties Reloaded

When using a standard spring PropertyPlaceholderConfigurer, properties will be read from a file, and their values can be referenced using a ${…} macro syntax. The expanded property values are usually assigned to bean properties in the xml application context. Now what I would like to have is this: When the file changes, the properties should be read again, and the updated values should be assigned to the original beans’ properties. The standard Spring answer would be “shut down the application context and launch a new one”, but often we can be much more flexible without disrupting operation (e.g. changing the size of a cache etc.)

Jms

Spring Txn. Context Startup. Java - Spring Parent Child Context and Application Listeners. Spring Security. Are You Using The Full Power Of Spring For Your Dependency Injection Needs? If you’re a serious Java (or possibly even .NET) developer you’ve most likely used the Spring Framework before for all you dependency injection needs.

Are You Using The Full Power Of Spring For Your Dependency Injection Needs?

You therefore probably know that there are 2 common ways to inject dependencies into your spring beans: setter injection constructor injection But, did you know that there is a lot more to it than that? Spring has some extremely powerful capabilities that allow you to do a lot more than just call constructors and setters when creating Spring beans and injecting dependencies.

I am going to attempt to show you some ways that will allow you to create spring beans and inject dependencies in all sorts of different ways, which should let you get a lot more out of using Spring. Different Ways To Instantiate Beans And Inject Dependencies. Using JMX within a spring application. Lately I have been doing a lot with JMX.

Using JMX within a spring application

I use it more and more to check what my application is doing. I use it to monitor tomcat, the cache, queue’s and other libraries and components. Using JMX within a spring application. Spring Android and Maven (Part 2) In Spring Android and Maven (Part 1), I described how to build an Android application from the command-line using Maven.

Spring Android and Maven (Part 2)

In this post, I will show you how to build an Android application with Maven dependency management from the Eclipse IDE. The application will also showcase the latest features in Spring Android 1.0.0.M2, which was released this week. Overview The Maven Android Plugin lets you build your Android applications with Maven and benefit from dependency management. Google's Android Development Tools (ADT) plugin allows you to develop and build Android applications within the Eclipse IDE. The specific versions of each component used in this post are listed below: Configure Eclipse Before building or compiling any code, we need to install and configure the required Eclipse plugins.

There are three Eclipse plugins that need to be installed, the ADT Plugin for Eclipse, Maven Integration for Eclipse, and Maven Integration for Android Development Tools. Manual Plugin Installation. Reference Documentation. Spring. I recently evaluated the use of Acegi as the security framework for a Web development project.

spring

In the end, we decided to move forward with Acegi but in the beginning it took a couple days to come to that decision. The amazing thing is: once you get over the initial learning curve, it's smooth sailing. Hence, I wanted to share my experiences with it because first, I wanted to expose the Acegi security framework to JDJ readers and, second, I wanted to make it easier for JDJ readers to get over the initial learning curve. Once you're over that, you should be well on your way with Acegi. Exposing Acegi Security Framework Acegi is an open source security framework that allows you to keep your business logic free from security code. Acegi uses Spring as its configuration settings, so those familiar with Spring will be at ease with Acegi configuration.

Why use Acegi instead of JAAS? Using Spring to Receive JMS Messages. Have you ever had a need to create your own JMS consumer?

Using Spring to Receive JMS Messages

Or will you have this need in the future? If you answered yes to either one of these questions, this post will simplify your life. In the previous post, I discussed Using the Spring JmsTemplate to Send JMS Messages. As a follow-on, in this post I will demonstrate how to receive messages using Spring JMS. Although the previously mentioned JmsTemplate can receive messages synchronously, here I will focus on asynchronous message reception using the Spring message listener container architecture, specifically the DefaultMessageListenerContainer. Sharing a spring context across multiple Webapps. Last month I gave a Core Spring training in Turkey. At the end of the course I discussed the architecture for an application that some of the participants were going to build after completing the course. This application would consist of an ear file with several war files inside, and the question came up if it was possible to define a single ApplicationContext that could be used as a shared parent to the WebApplicationContexts of all war files.

This context would hold bean definitions for services, dao's and other beans that were not specific to a single web module. Actually, Spring makes it very easy to do this, but neither the course nor the reference manual explain in detail how to use this feature from your web application. I therefore wrote a short sample app that illustrates how this works, which I will discuss here in my first blog entry. The ContextLoader and SingletonBeanFactoryLocator classes <! Chapter 3. Beans, BeanFactory and the ApplicationContext. Chapter 3. The IoC container. Chapter 3.

Chapter 3. The IoC container

The IoC container This chapter covers the Spring Framework's implementation of the Inversion of Control (IoC) [1] principle. The org.springframework.beans and org.springframework.context packages provide the basis for the Spring Framework's IoC container. The BeanFactory interface provides an advanced configuration mechanism capable of managing objects of any nature. The ApplicationContext interface builds on top of the BeanFactory (it is a sub-interface) and adds other functionality such as easier integration with Spring's AOP features, message resource handling (for use in internationalization), event propagation, and application-layer specific contexts such as the WebApplicationContext for use in web applications.

In short, the BeanFactory provides the configuration framework and basic functionality, while the ApplicationContext adds more enterprise-centric functionality to it.

Web Services

Spring-web-setup-Dispatchv/sContextLoaderListener.