Integration example of Spring and BlazeDS with Maven2.
Multiproject EAR:
- Flex 4
- Spring 3
- BlazeDS 3
Downloads
Projects
Utilities
Friends
LinksIntegration example of Spring and BlazeDS with Maven2.
Multiproject EAR:
- Flex 4
- Spring 3
- BlazeDS 3
Vote at your favorite country.
¡Choose with your vote the most favorite country in the world!
- Click in the mark of the country.
- Add points to your favorite country to improve it in the ranking.
- Remove points to the other countries.
Technology:
- Flex-Cairngorm
- J2EE-Blazeds-Spring-Hibernate
- MySQL
Spring can provide DAO’s beans through three strategies:
<bean id="myDao" class="app.dao.MyDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="myService" class="app.service.myService">
<property name="dao" ref="myDao"/>
</bean>
Define servies properties
private IMyDao dao;
public IMyDao getDao() {
return dao;
}
public void setDao(IMyDao dao) {
this.dao = dao;
}
Factory implementation:
package app.dao;
public class MyDaoFactory {
private static MyDaoFactory instance;
private IMyDao instanceDAO;
public static MyDaoFactory getInstance() {
if (instance == null) {
instance = new MyDaoFactory();
}
return instance;
}
public IMyDao getInstanceDAO() {
return getInstance().instanceDAO;
}
public void setInstanceDAO(IMyDao instanceDAO) {
this.instanceDAO = instanceDAO;
}
}
ApplicationContext declaration (inject DAO on the factory):
<bean id="myDao" class="app.dao.MyDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="myDaoFactory" class="app.dao.MyDaoFactory">
<property name="instanceDAO">
<ref local="myDao"/>
</property>
</bean>
Use it in the service:
IMyDao myDao=MyDaoFactory.getInstance().getInstanceDAO();
ApplicationContext ctx = new ClassPathXmlApplicationContext(
new String[] { "applicationContext.xml" });
IMyDao myDao = (IMyDao) ctx.getBean("myDao");

Application example with Flex, BlazeDS and Spring. On this configuration you must notice on SpringFactory which provide beans of Spring to BlazeDS.
Flex Cient
Must be changed with the project url path on following files:
Servidor
build.properties must be configured with local parameters.
Project don’t include following necessary libraries(provided with spring and blazeds):
aspectjrt.jar, aspectjweaver.jar, backport-util-concurrent.jar, cfgatewayadapter.jar, commons-codec-1.3.jar, commons-dbcp.jar, commons-httpclient-3.0.1.jar, commons-logging.jar, commons-pool.jar, concurrent.jar, flex-messaging-common.jar, flex-messaging-core.jar, flex-messaging-opt.jar, flex-messaging-proxy.jar, flex-messaging-remoting.jar, hsqldb.jar, servlet-api.jar, spring.jar, standard.jar y xalan.jar.
To deploy the project:
for the icon set used in this blog.