O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

JBoss Snowdrop

4.324 visualizações

Publicada em

Lightning talk about JBoss Snowdrop project

Publicada em: Tecnologia, Educação
  • Seja o primeiro a comentar

JBoss Snowdrop

  1. 1. JBOSS SNOWDROP TITLE SLIDE: HEADLINE Presenter Lukáš Vlček name Senior QAHat Title, Red Engineer, JBoss January 25th, 2010 Date 1 CZJUG JAN-2010 | LUKAS VLCEK
  2. 2. What is JBoss Snowdrop? ● Informal: “... you can easily develop, deploy and run Spring based applications on JBoss AS utilizing its JEE services” ● More formal: Snowdrop is a utility package that contains JBoss specific extensions to the Spring Framework. ● License: LGPL v2.1 ● Hosted: http://jboss.org/snowdrop 2 CZJUG JAN-2010 | LUKAS VLCEK
  3. 3. Why Using Spring on JBoss AS? ● Spring provides popular development model ● JBoss AS provides runtime services ● More details: Spring on JBoss, JBoss World 2009 by Marius Bogoevici (Snowdrop lead developer) “JBoss is a great place for running Spring applications!” ● http://www.redhat.com/f/pdf/jbw/mbogoevici_1050_spring_on_jboss.pdf 3 CZJUG JAN-2010 | LUKAS VLCEK
  4. 4. Spring Deployer ● Recognizes and deploy Spring applications ● /META-INF/*-spring.xml (archives: JAR, WAR, EAR...) How it works: Spring deployer parses the deployment descriptor to create a Spring bean factory, and registers that Spring bean factory under some JNDI name so that it can be looked up and used by other applications. And if deployed archive is removed, JBoss destroy the bean factory and unregister it from JNDI. 4 CZJUG JAN-2010 | LUKAS VLCEK
  5. 5. Example of /META-INF/jboss-spring.xml ● Spring BeanFactory is registered in JNDI with name SpringDao. <?xml version="1.0" encoding="UTF­8"?> <beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/XMLSchema­instance"        xsi:schemaLocation="http://www.springframework.org/schema/beans        http://www.springframework.org/schema/beans/spring­beans.xsd">     <description>BeanFactory=(SpringDao)</description>     <import resource="classpath*:dao­context.xml"/>     <import resource="classpath*:infrastructure.xml"/> </beans> 5 CZJUG JAN-2010 | LUKAS VLCEK
  6. 6. JBoss Virtual File System ● JDK URL resource handling is not easy ● Windows file locking, code duplicity ● Virtual File System was created to solve these issues but resource and classpath scanning in Spring's 2.5.x did not work properly: ● if resource path has [*] after [:] <import resource=”classpath*:META­INF/*.xml”/> ● if classes need to be scanned for annotations <context:component­scan base­package="org.jboss.snowdrop.sample.springmvc"/> 6 CZJUG JAN-2010 | LUKAS VLCEK
  7. 7. JBoss VFS Support Solution ● JBoss added two implementations of ApplicationContext Spring class JBoss class ClassPathXmlApplicationContext VFSClassPathXmlApplicationContext XmlWebApplicationContext VFSXmlWebApplicationContext <servlet>    <servlet­name>spring­mvc­servlet</servlet­name>    <servlet­class>org.springframework.web.servlet.DispatcherServlet</servlet­class>    <init­param>       <param­name>contextClass</param­name>       <param­value>          org.jboss.spring.vfs.context.VFSXmlWebApplicationContext       </param­value>    </init­param>    <init­param>       <param­name>contextConfigLocation</param­name>       <param­value>/WEB­INF/spring­servlet­context.xml</param­value>   </init­param> </servlet> 7 CZJUG JAN-2010 | LUKAS VLCEK
  8. 8. Injecting Spring Beans in EJB3 ● Spring deployer introduced new annotation: @Spring ● Using Spring @Autowired annotation @Stateless @Interceptors(SpringLifecycleInterceptor.class) @LocalBinding(jndiBinding = "sportsclub/SubscriptionService") public class SubscriptionServiceImpl implements SubscriptionService {    @Spring(bean = "accountRepository", jndiName = "SpringDao")    private AccountRepository accountRepository;    @Spring(bean = "personRepository", jndiName = "SpringDao")    private PersonRepository personRepository;  ... } 8 CZJUG JAN-2010 | LUKAS VLCEK
  9. 9. JSF and Spring ● Spring provides implementation of ELResolver faces­config.xml <application>     <view­handler>com.sun.facelets.FaceletViewHandler</view­handler>     <el­resolver>         org.springframework.web.jsf.el.SpringBeanFacesELResolver     </el­resolver> </application> web.xml <context­param>     <param­name>contextConfigLocation</param­name>     <param­value>/WEB­INF/spring­beans.xml</param­value> </context­param> <listener>     <listener­class>         org.springframework.web.context.ContextLoaderListener     </listener­class> </listener> 9 CZJUG JAN-2010 | LUKAS VLCEK
  10. 10. Not Covered in this Lightning Talk ● JTA ● JAX-WS ● JPA ● JMX ● Tooling (JBoss Eclipse extensions) ... see Snowdrop examples and Marius' presentation 10 CZJUG JAN-2010 | LUKAS VLCEK
  11. 11. Snowdrop Status ● 1.0.0GA released in October 2009 ● Supports ● JBoss AS 5.x (preferably 5.1.0 GA) ● Spring 2.5.x (preferably 2.5.6 SEC01) ● 1.1.0GA to be released soon 11 CZJUG JAN-2010 | LUKAS VLCEK
  12. 12. Snowdrop Roadmap ● Spring AOP integration with JBoss AOP ● Spring integration with JBoss MC ● Clustering support for Spring through Infinispan ● Spring 3 ● JBoss AS 6 12 CZJUG JAN-2010 | LUKAS VLCEK
  13. 13. Related Articles ● Spring and EJB 3.0 in Harmony, Aleš Justin (2006 ~ little dated) http://java.sys-con.com/node/180386 Spring deployer, Injecting Spring into EJB ● DZone JBoss Microcontainer Series, Aleš Justin (2008-2009) Component Model, Advanced Dependency Injection and IoC, Virtual File System, ClassLoading Layer 13 CZJUG JAN-2010 | LUKAS VLCEK
  14. 14. Questions? 14 CZJUG JAN-2010 | LUKAS VLCEK