Chapter 2. Code Integration
Being able to make Java and Scala cooperate on the same code base is a prerequisite to guarantee a smooth transition between the two languages.
In this chapter, we are going to quickly create a small Java web application in which we will show you how to add Scala code to it. Then, we will cover some of the most common integration points between Java and Scala and how programming styles differ so that programmers who want to refactor and extend their Java application can do it according to some guidelines.
To avoid spending too much time on creating, understanding, and documenting a sample Java project, we are going to use a small database that is already available as part of the Oracle's NetBeans IDE distribution and create a JPA persistence layer as well as a REST API from it using the code generation features of the IDE.
Tip
Download the sample Java project
If you are impatient to directly jump into the Scala code integration features of this chapter, you may skip...