How do you implement user registration and login in Spring Boot?
Store users with BCrypt-hashed passwords, load them with a UserDetailsService and secure URLs with a SecurityFilterChain bean in Spring Boot 3.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Store users with BCrypt-hashed passwords, load them with a UserDetailsService and secure URLs with a SecurityFilterChain bean in Spring Boot 3.
@EnableGlobalMethodSecurity enabled method-level security but is deprecated since Spring Security 5.8. Learn how @EnableMethodSecurity replaces it.
Set up Spring Security in Spring Boot with a SecurityFilterChain, form login, database users, password hashing and method-level authorization.
Flyway has no @SqlMigration annotation. Learn how versioned and repeatable SQL migrations and Java migrations are defined, including Spring Boot setup.
Set up Flyway in Spring Boot, write versioned and repeatable SQL migrations, run commands and follow the rules that keep production schemas safe.
Flyway and Liquibase apply versioned schema migrations automatically, keeping every environment's database in step with your Spring Boot code.
The JPA cascade attribute propagates persist, merge, remove, refresh and detach from a parent entity to related entities. Learn each CascadeType and when to use it.
@ManyToOne owns the foreign key and @OneToMany(mappedBy) exposes the children from the parent. See how to map, cascade and fetch both sides correctly.
Map one-to-one, one-to-many and many-to-many relationships in JPA with correct owning sides, helper methods, cascade rules and lazy loading.
Learn the four ways to extend a Spring Data JPA repository: derived queries, @Query, specifications and custom fragment implementations.
Extending JpaRepository lets Spring Data generate CRUD, paging, sorting and query methods for your entity without writing an implementation.
Add custom queries and logic to Spring Data JPA by writing a fragment interface, an Impl class and extending it from your repository.
Run bulk updates, deletes and inserts efficiently in Spring Data JPA using @Modifying queries and Hibernate batching, and avoid stale persistence context bugs.
Specification wraps the JPA Criteria API into small reusable conditions you combine with and, or and not. This guide covers toPredicate, joins and paging.
Compare the main ways to build dynamic queries in Spring Data JPA, with working Specification, Querydsl and Criteria examples for optional filters.
@Query lets you write custom JPQL or native SQL on Spring Data JPA repository methods. See parameters, pagination, projections and bulk updates.
Write custom Spring Data JPA queries with @Query in JPQL or native SQL, use projections and Specifications, and add custom repository implementations.
Spring Data's Sort class defines result ordering. Learn Sort.by, repository usage, pagination with tie-breakers and safe handling of client input.
Spring Data JPA sorts through a Sort argument, an OrderBy clause in the method name, or ORDER BY in a query. Learn when to use each and how to sort by several fields.
Build a stable custom pagination response in Spring Boot with Pageable, a generic PageResponse record, DTO mapping, size limits and alternatives.