Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Kotlin for Enterprise Applications using Java EE
Kotlin for Enterprise Applications using Java EE

Kotlin for Enterprise Applications using Java EE: Develop, test, and troubleshoot enterprise applications and microservices with Kotlin and Java EE

eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Kotlin for Enterprise Applications using Java EE

Kotlin – The Game Changer

Enterprises typically develop their applications or microservices based on Java. Java is the first choice of language for development because it is robust, safe, and backward compatible. Java's platform independence makes it suitable for developing web services and enterprise applications. Having said that, however, have we ever considered whether there might be a better way to write code, one that makes it easy not only to develop an application, but also to maintain it over a period of time?

With its elegant syntax and numerous features, Kotlin makes it much easier to work with. Writing code with Kotlin is much simpler. We can develop complex applications quickly and maintain them easily:

The following topics will be covered in this chapter:

  • What makes Kotlin stand out among other JVM-based languages
  • A comparison with Java
  • How to configure...

Technical requirements

We will use IDEs, such as IntelliJ IDEA and Eclipse, to set up the project. A knowledge of working with these IDEs is helpful.

Why Kotlin is the game changer

Kotlin offers many features of modern languages. It has null safety, a functional style of coding, non-verbose code, and is clean and easy when it comes to using Java's stream operations, including filter, map, reduce, and more. All of these can help to improve your development life cycle and productivity.

Kotlin was developed with the intention of adding features that are not found in existing JVM languages. It is a modern JVM language that has full interoperability with Java, ensuring that existing applications or services don't face any problems with coexisting with Kotlin. If we are familiar with functional paradigms, it will be easier to make use of the power of the language.

Interoperability with Java

...

Kotlin versus Java

When we think of developing an application, Java is one of the programming languages that comes to mind for various reasons, including its robust and secure nature, and the independence of its platform. Most enterprise applications are built using Java, and this particular programming language has been around for more than 20 years.

Kotlin is designed to be interoperable with Java, meaning Kotlin can seamlessly co-exist with Java. We can add Kotlin to our existing applications and we can use Java-based frameworks for application development. With this bi-directional use of Kotlin, we can invoke Java constructs from Kotlin, or Kotlin constructs from Java.

Although Java and Kotlin are both JVM-based languages used for application development, there are several differences between them. Kotlin has addressed some of the limitations previously associated with Java...

Configuring Kotlin in the project

Now that we have learned about the benefits that the Kotlin language offers, let's see how to configure Kotlin in a project. In this section, we will look at how to create a simple Kotlin project and a Maven project using IntelliJ IDEA.

Creating a simple Kotlin project

It's easy to create a Kotlin-JVM project using IntelliJ IDEA by observing the following steps:

  1. Click on File | New | Project.
  2. In the New Project window, select Kotlin/JVM, and choose Next. This is shown in the following screenshot:
  1. In the next wizard, specify the Project name and the Project location. Choose JDK and Kotlin runtime and click on Finish.
  1. In the modules settings, click on Facets and add Kotlin to...

Working with coroutines

A program in execution that initiates long-running operations, such as file IO, network IO, or CPU- or GPU-intensive work, requires the invoker to block until the operations complete. Programming languages handle this via concurrency.

The JVM has support for concurrency. Java has had strong support for multithreading and concurrency since its first release. Any process that is running inside the JVM can create a number of threads to execute multiple tasks in an asynchronous fashion. However, developing concurrent code in an optimal and error-free manner and debugging it is really challenging. Java provides various constructs to write concurrent code and, along with other JVM languages and third-party libraries, has tried to come up with innovative and elegant ways to achieve concurrency.

Java 5 made a lot of progress with regard to writing concurrent applications...

Using Kotlin with Java

We will now discuss how to work with Kotlin and Java in the project that we created.

In this section, we will learn how to use Kotlin in an existing Java project, and Java in an existing Kotlin project.

One of Kotlin's important features is its interoperability with Java. If we have an existing Java project, we can add new code in Kotlin or we can convert the existing Java code to Kotlin.

Kotlin in an existing Java project

Let's look at an example of how to add Kotlin code to an existing Java project created using Maven. We have created a simple Maven project that has some code written in Java. This is shown here:

We can add Kotlin code to it as follows.

  1. Right-click on src/main/java and...

Summary

In this chapter, we have discussed the following:

  • What Kotlin offers and why it is a game changer in enterprise applications
  • How Kotlin language compares with Java
  • How to configure Kotlin in a project
  • What Coroutines are
  • Intermixing Kotlin and Java
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • An in-depth guide updated with all the latest features of Kotlin 1.2 and Java EE 8
  • Build microservices in Java EE with the help of Kotlin use cases
  • Explore coroutines, garbage collection, multithreading, memory management and more

Description

Kotlin was developed with a view to solving programmers’ difficulties and operational challenges. This book guides you in making Kotlin and Java EE work in unison to build enterprise-grade applications. Together, they can be used to create services of any size with just a few lines of code and let you focus on the business logic. Kotlin for Enterprise Applications using Java EE begins with a brief tour of Kotlin and helps you understand what makes it a popular and reasonable choice of programming language for application development, followed by its incorporation in the Java EE platform. We will then learn how to build applications using the Java Persistence API (JPA) and Enterprise JavaBeans (EJB), as well as develop RESTful web services and MicroServices. As we work our way through the chapters, we’ll use various performance improvement and monitoring tools for your application and see how they optimize real-world applications. At each step along the way, we will see how easy it is to develop enterprise applications in Kotlin. By the end of this book, we will have learned design patterns and how to implement them using Kotlin.

Who is this book for?

Kotlin for Enterprise Applications using Java EE is for Java EE developers who want to build their enterprise project or application with Kotlin or migrate from Java to Kotlin. Basic knowledge of programming is necessary to understand the key concepts covered in this book.

What you will learn

  • Understand Kotlin syntax and appreciate why it's gaining in popularity
  • Explore the Java EE ecosystem and the APIs in Java EE
  • Implement applications using Kotlin
  • Overcome the challenges of developing the Java EE system using Kotlin
  • Gain insights into Java Message Services (JMS)
  • Build RESTful MicroServices and secure applications
  • Optimize applications with performance and monitoring tools
  • Understand design patterns and implement them

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 30, 2018
Length: 388 pages
Edition : 1st
Language : English
ISBN-13 : 9781788994392
Vendor :
Oracle
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 30, 2018
Length: 388 pages
Edition : 1st
Language : English
ISBN-13 : 9781788994392
Vendor :
Oracle
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 110.97
Mastering Java 11
€36.99
Hands-On Object-Oriented Programming with Kotlin
€36.99
Kotlin for Enterprise Applications using Java EE
€36.99
Total 110.97 Stars icon
Banner background image

Table of Contents

12 Chapters
Kotlin – A First look Chevron down icon Chevron up icon
Kotlin – The Game Changer Chevron down icon Chevron up icon
An Overview of Java EE and Kotlin Chevron down icon Chevron up icon
Kotlin with JSF and CDI Chevron down icon Chevron up icon
Kotlin with JPA and EJB Chevron down icon Chevron up icon
Enterprise Messaging with Kotlin Chevron down icon Chevron up icon
Developing RESTful Services with JAX-RS Chevron down icon Chevron up icon
Securing JAVA EE Applications with Kotlin Chevron down icon Chevron up icon
Implementing Microservices with Kotlin Chevron down icon Chevron up icon
Performance Monitoring and Logging Chevron down icon Chevron up icon
Design Patterns with Kotlin Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.