Book Image

Building Applications with Spring 5 and Kotlin

By : Miloš Vasić
Book Image

Building Applications with Spring 5 and Kotlin

By: Miloš Vasić

Overview of this book

Kotlin is being used widely by developers because of its light weight, built-in null safety, and functional and reactive programming aspects. Kotlin shares the same pragmatic, innovative and opinionated mindset as Spring, so they work well together. Spring when combined with Kotlin helps you to reach a new level of productivity. This combination has helped developers to create Functional Applications using both the tools together. This book will teach you how to take advantage of these developments and build robust, scalable and reactive applications with ease. In this book, you will begin with an introduction to Spring and its setup with Kotlin. You will then dive into assessing the design considerations of your application. Then you will learn to use Spring (with Spring Boot) along with Kotlin to build a robust backend in a microservice architecture with a REST based collaboration, and leverage Project Reactor in your application. You’ll then learn how to integrate Spring Data and Spring Cloud to manage configurations for database interaction and cloud deployment. You’ll also learn to use Spring Security to beef up security of your application before testing it with the JUnit framework and then deploying it on a cloud platform like AWS.
Table of Contents (12 chapters)

What will be deployed?

Before we deploy anything, we must provide everything that will be deployed. For this, we will deploy the JAR of our API module. The JAR is a result of application building. The first thing we will do is prepare our application for release. We will change our port from 9000 to 80. Open the application.properties file and make the following changes:

spring.application.name= journaler 
server.port= 80 
logging.level.root=INFO 
logging.level.com.journaler.api=DEBUG 
logging.level.org.springframework.jdbc=ERROR 
 
endpoints.health.enabled=true 
endpoints.trace.enabled=true 
endpoints.info.enabled=true 
endpoints.metrics.enabled=true 
 
spring.datasource.url=jdbc:mysql://localhost/journaler_api?useSSL=false&useUnicode=true&characterEncoding=utf-8 
spring.datasource.username=root 
spring.datasource.password=localInstance2017 
spring.datasource.tomcat.test...