Monday, November 17, 2008

Integrated BlazeDS with Spring Framework

Spring is one of the most popular Java frameworks. The foundation of the Spring framework is a lightweight component container that implements the Inversion of Control (IoC) pattern.
Using an IoC container, components don't instantiate or even look up their dependencies (the objects they work with). The container is responsible for injecting those dependencies when it creates the components (hence the term "Dependency Injection" also used to describe this pattern).
The result is looser coupling between components. The Spring IoC container has proven to be a solid foundation for building robust enterprise applications. The components managed by the Spring IoC container are called Spring beans.

step by step:

1. Follow this article to create a basic blazeds-based java project.
2. Download spring framework and put the spring.jar into the blazeds-based java project.
3. Download flex-spring.zip and unzip it and put the SpringFactory.java to your source code folder. don't fotget to adjust the package name according to your package path.
4. Register the Spring factory on your services-config.xml.
5. Create applicationContext.xml in /WEB-INF and register Spring beans.
6. Update your remoting-config.xml.
7. Update your web.xml.
8. Create your flex app and new remoteObject to call java module.

For another new way to integrate spring to blazeds, pls go to Using Spring BlazeDS Integration 1.0.0.M1 .

sample code:
blazeds-spring-server-tutorial.rar and blazeds-spring-client-tutorial.rar , enjoy it.

No comments:

Post a Comment