Your SlideShare is downloading. ×
0
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Spring Scala
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Spring Scala

427

Published on

Speakers: Ramnivas Laddad and Arjen Poutsma …

Speakers: Ramnivas Laddad and Arjen Poutsma
The Spring Framework is one of the most popular Java frameworks used today. While it is possible to use Spring in Scala, it does feel awkward in certain places, because of the "Javaism" peering through. For instance, using callback interfaces feels strange in Scala; functions would be a better match.
At SpringOne 2GX last year, I introduced the Spring Scala project, which solves this particular issue, and aims to make it easier to use Spring in Scala in general. In this session, we discuss the Spring Scala portfolio project and its feature set.
We will also show a real-world application that combines robustness and maturity of the Spring Framework with coolness of Scala. It features a REST-based architecture with on Spring and Scala backend and AngularJS frontend to offer a modern, single-page experience.

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
427
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. Spring Scala Arjen Poutsma Ramnivas Laddad Pivotal © 2013 SpringOne 2GX. All rights reserved. Do not distribute without permission.
  2. About Arjen • Twenty years of experience in Enterprise Software Development • Joined SpringSource in 2005 • Development lead of Spring Web Services • Development lead on Spring 3’s REST support • Dabbled in Scala in 2008 2
  3. Why Spring and Scala? • Scala has many exciting features –Pattern matching, implicits, functions, JVM, ... • Spring is the de facto Java Enterprise framework –more than DI, proven, 10+ development years, ... • Why not combine them? 3
  4. Introducing Spring Scala • Separate Spring portfolio project • Introduced at last year’s SpringOne 2GX • Goal: make it easier to use Spring in Scala • Built on top of the Spring Java Framework 4
  5. Spring Scala Features • Wiring up Scala Beans in XML –Support for Scala Collections • Wiring up Scala Beans in Scala • Scala-friendly versions of Spring Templates 5
  6. Wiring up in XML • Constructor injection, or • @BeanProperty, or • Spring Scala & Spring 3.2+ 6
  7. Properties in Scala class  A(var  b:  String) public  class  A  { private  String  b; public  A(String  b)  { this.b  =  b; } public  String  b()  { return  b; } public  void  b_$eq(String  b)  { this.b  =  b; } } 7
  8. Demo 8
  9. Scala Collections • Rich API • Seq, IndexedSeq, LinearSeq, Buffer, Set, Map, etc. • Mutable and Immutable version • Spring Scala supports all of these –PropertyEditors –XML namespace 9
  10. Demo 10
  11. Wiring up in Scala • FunctionalConfiguration (aka ScalaConfig) • Singletons and prototypes • Bean references • Configuration Composition • Importing XML and @Configuration • Init and destroy methods • Bean Profiles 11
  12. <beans>        <bean  class="Person">                <constructor-­‐arg  value="John"/>                <constructor-­‐arg  value="Doe"/>        </bean> </beans> class  PersonConfiguration    extends  FunctionalConfiguration  {        bean()  {                new  Person("John",  "Doe")        } } 12
  13. Demo 13
  14. Spring Templates • Consistent and convenient approach to data access –JdbcTemplate, JmsTemplate, ... • Spring Scala has Scala versions of these: –Functions instead of callbacks –Option 14
  15. JmsTemplate val  connectionFactory  :  ConnectionFactory  =  ... val  template  =  new  JmsTemplate(connectionFactory) template.send("queue")  {        session:  Session  =>  session.            createTextMessage("Hello  World") } template.receive("queue")  match  {        case  Some(m:  TextMessage)=>  println(m.getText)        case  None  =>  println("No  text  message  received") } 15
  16. Demo 16
  17. Further information • Github repo opened October 2012 • First milestone released December 2012 • Second milestone released April 2013 • First release candidate release September 2013 • 1.0 GA “soon” • Community-driven https://github.com/SpringSource/spring-scala 17

×