Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spring 4, Java EE 7 or Both? @JavaLand 2014

Spring 4, Java EE 7 or Both? @JavaLand 2014

Slides from my presentation at JavaLand 2014.

ivargrimstad

March 26, 2014
Tweet

More Decks by ivargrimstad

Other Decks in Programming

Transcript

  1. Ivar Grimstad About Spring 4, Java EE 7 or Both?

    @ivar_grimstad @ivar_grimstad
  2. • Spring 4 • Java EE 7 • Combining Spring

    4 with Java EE 7 Contents Spring 4, Java EE 7 or Both? @ivar_grimstad
  3. Timeline Spring 4, Java EE 7 or Both? @ivar_grimstad Spring

    4 Spring 3 Spring 2 Spring 1 Java EE 7 Java EE 6 Java EE 5 J2EE 1.4 J2EE 1.3 J2EE 1.2 JPE Spring 1998 2014
  4. lambda expressions method references @Repeatable Java 8 Support Spring 4,

    Java EE 7 or Both? @ivar_grimstad @Fruit(1) @Fruit(2) class Bowl{} @Fruits({@Fruit(1), @Fruit(2)}) class Bowl{}
  5. • Java EE 6 is the baseline – Servlet 3.0

    – JPA 2.0 • Java EE 7 Supported Specifications – JMS 2.0 – JTA 1.2 – JPA 2.1 – Bean Validation 1.1 – Concurrency Utilities Java EE 7 Support Spring 4, Java EE 7 or Both? @ivar_grimstad
  6. Generic qualifiers Core Container Improvements Spring 4, Java EE 7

    or Both? @ivar_grimstad @Autowired private Foo<Integer> i; @Autowired private Foo<String> s;
  7. Java EE 7 vs Spring 4 Spring 4, Java EE

    7 or Both? @ivar_grimstad
  8. Spring 4 vs Java EE 7 Spring 4, Java EE

    7 or Both? @ivar_grimstad
  9. • Create a Spring 4 application • Rewrite it to

    Java EE 7 • Combine the two approaches • Run them in different application servers – WildFly – Glassfish – Tomcat Demo Contents Spring 4, Java EE 7 or Both? @ivar_grimstad
  10. Spring 4 - Configuration Spring 4, Java EE 7 or

    Both? @ivar_grimstad @Configuration @ComponentScan("eu.agilejava.spring4") @EnableWebMvc public class ApplicationConfig extends WebMvcConfigurerAdapter { }
  11. Java EE 7 - Configuration Spring 4, Java EE 7

    or Both? @ivar_grimstad @ApplicationPath("api") public class ApplicationConfig extends Application {
  12. Spring 4 + Java EE 7 - Configuration Spring 4,

    Java EE 7 or Both? @ivar_grimstad @Configuration @ComponentScan("eu.agilejava.both") @ApplicationPath("api") public class ApplicationConfig extends Application { }
  13. • No configuration changes • No code changes • New

    dependency (pom.xml) Spring 4 - Portability Spring 4, Java EE 7 or Both? @ivar_grimstad
  14. • Minor configuration changes • No code changes • No

    new dependencies (pom.xml) Java EE 7 - Portability Spring 4, Java EE 7 or Both? @ivar_grimstad
  15. • Configuration changes • No code changes • New dependencies

    (pom.xml) Spring 4 + Java EE 7 - Portability Spring 4, Java EE 7 or Both? @ivar_grimstad
  16. • Spring 4 is more portable • Even across Java

    EE 7 app servers • Java EE 7 requires less configuration • And fewer dependencies Conclusion Spring 4, Java EE 7 or Both? @ivar_grimstad
  17. Favor one framework over mixing One Last Tip Spring 4,

    Java EE 7 or Both? @ivar_grimstad