Using Spring with Scala
summary
Translates several spring.io guides from Java to Scala and runs them with Gradle with scala plugin, keeping Spring Boot and Gradle as the build tooling. Implements MVC, REST client, Spring Data REST and JDBC examples; annotations work largely unchanged but request mapping needs an array for multiple paths and Scala beans require bean property annotation for getters/setters. Scala functions are not usable as Java 8 lambdas for Spring callbacks (use anonymous classes), Spring Data needs java.lang.Long for IDs, and JavaConverters handle collection interop; all examples run and code is on GitHub.
AI-written summary · about
chapters (30)
- 0:00Intro
- 0:48Overview
- 1:29Target audience
- 2:21Why Scala?
- 5:14Why Scala & Spring
- 6:382. Examples
- 8:02First example: serving web content with Spring MVC
- 8:30Make Gradle work with Scala
- 9:39Application class
- 11:05Template
- 11:17Controller
- 12:53Example: consuming REST services
- 13:08Beans in Scala
- 14:28Asynchronous version using Lambdas
- 15:10Java 8 Lambdas vs. Scala function literals
- 16:03We need ugly anonymous classes
- 17:15Person resource in Scala
- 17:30Repository
- 18:55Final example: JDBC
- 19:44JDBC: Java Batch Update
- 20:59JDBC Scala names collection
- 21:54JDBC Scala batchUpdate
- 22:55Convert from Scala
- 23:43JDBC Scala print query
- 24:03Convert from Java
- 24:30Translation steps . Use Scala mutable collection when calling Java
- 24:503. Evaluation
- 25:40Simple translation steps
- 26:41Scala SDK is getting better dealing with Java
- 27:50Conclusion
related talks
58mSpring and Kotlin: A Winning Combination
52mSpring into Kotlin: How to Make the Magic even more Magical
47mWhy Spring ❤ Kotlin
52mSpring Recipes: A Collection of Common-Sense Solutions
59mSpring into Kotlin: How to Make the Magic even more Magical
48mSpringing into Kotlin
31mSpring extensions for Kotlin
49mMagical Beans and Mystery
