Spring Boot 4.1 introduces type-safe property paths in Spring Data Commons, eliminating the need for stringly-typed property references when sorting, querying, or navigating nested entity paths. Previously, using string-based property names in Sort or Criteria queries would compile and pass tests but fail at runtime with cryptic errors. The new API lets developers reference entity properties via generated type-safe path objects (e.g., Person.lastName instead of "lastName"), catching mistakes at compile time. The feature works across Spring Data JPA, JDBC, and other Spring Data modules, and is demonstrated with three examples: simple sorting, criteria queries, and composite/nested property paths.
•18m watch time
1.9K Impressions1 Comment