Spring Boot 4 · Controllers and beans

Define a JPA entity

Map a class to a database table.

@Entity
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String name;
}

Official Spring Boot 4 documentation

More controllers and beans commands

All controllers and beans commands · Spring Boot 4 cheatsheet

Was this page helpful?