---
title: "Discussion on \"Spring Boot and Java 16 Records\" | Hashnode"
description: "Discussion on \"Spring Boot and Java 16 Records\". In this article, we will discuss Java 16's newest feature, Records. Then we will apply this knowledge and use it in conjunction with a Spring Boot app"
url: "https://hashnode.com/posts/spring-boot-and-java-16-records/6053d1308899a615727e64c1"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Spring Boot and Java 16 Records](https://ashishtechmill.com/spring-boot-and-java-16-records?utm_source=hashnode&utm_medium=feed)

In this article, we will discuss Java 16's newest feature, Records. Then we will apply this knowledge and use it in conjunction with a Spring Boot app

Mar 18, 2021 · 15 min read · ashishtechmill.com  
Updated Mar 20, 2021  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#springboot](https://hashnode.com/tag/springboot)
-   [#learning](https://hashnode.com/tag/learning)
-   [#coding](https://hashnode.com/tag/coding)

## Written by

[Ashish Choudhary](https://hashnode.com/@iashish)

@iashish · Pune, India

  
[View profile](https://hashnode.com/@iashish)

I like writing about technical stuff that I know and learn by implementing it. Java, BigData, and Cloud enthusiast.

Ashish Choudhary is a software engineer with over 10 years of experience in tech, including design, development, and web apps. He’s an active blogger and technical writer who loves Java, Spring Boot, DevOps, and the cloud, and is a strong advocate for open source.

## Responses 4

Markdown supported · ⌘↵ to post

[Deepak A L](https://hashnode.com/@DeepakLalchandani)

[Aug 17, 2021](https://hashnode.com/posts/spring-boot-and-java-16-records/6053d1308899a615727e64c1/comment/611bd2168b9c03054649ec2e)

Did you fix the error and is it working now correctly?

2021-03-19 02:01:55.434 ERROR 66059 --- \[nio-8080-exec-1\] o.a.c.c.C.\[.\[.\[/\].\[dispatcherServlet\] : Servlet.service() for servlet \[dispatcherServlet\] in context with path \[\] threw exception \[Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate \[com.example.indianstates.State\]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.example.indianstates.State.<init>()\] with root cause

[Ashish Choudhary](https://hashnode.com/@iashish)

[Aug 21, 2021](https://hashnode.com/posts/spring-boot-and-java-16-records/6053d1308899a615727e64c1/comment/611bd2168b9c03054649ec2e#reply-6121186da5d08237f40e0b18)

Yes you need to use RowMapper. Already explained in the article. You can check out the source code as well and let me know for any issues.

[Leo](https://hashnode.com/@zerocool)

[Jul 15, 2021](https://hashnode.com/posts/spring-boot-and-java-16-records/6053d1308899a615727e64c1/comment/60effe967d1ba0644913acda)

Nice article, Ashish!

It is interesting how different Java decompilers reconstruct the code. In your example **javap** produced a class that just extends java.lang.Record as if it is a good old Java 1.5 code.

But for example this [Java decompiler](https://www.decompiler.com/jar/46b68bf4387640fbb8e49895cf094b24/State.java) reconstructs code already with a **record** keyword.

[jian edc](https://hashnode.com/@edcjian)

[Jul 3, 2021](https://hashnode.com/posts/spring-boot-and-java-16-records/6053d1308899a615727e64c1/comment/60dfd6e84f8e376422a76725)

How to use it in JPA, it requires noArg constructor

[WD](https://hashnode.com/@WD)

[Apr 13, 2021](https://hashnode.com/posts/spring-boot-and-java-16-records/6053d1308899a615727e64c1/comment/6075b72785f3a21e3926d28f)

One of the features I like about Scala is the one line entity declaration. I'm working on a project with Java and I miss the one line declaration. Sure, I can use Intellij to generate boilerplate code but I personally do not feel it the same.

With regards to your code, is there any reason you prefer straight sql statements than using a ORM? Hibernate maybe?. I know performance would be one but I'm interested to know in alternatives.

Would you recommend java 16 for a project that would take 3 years to develop given that by that time code most likely be fully supported.

Good post btw.

Thanks.
