Objects.requireNonNull()
or custom checks.Optional
to handle nullable return values safely.var
for local variables where type is obvious (Java 10+).switch
expressions over traditional switch (Java 14+).record
for immutable data carriers (Java 14+).Stream
API for collection processing, but avoid overuse.CompletableFuture
for async operations.Pattern Matching for instanceof
(Java 16+) for cleaner type checks.Text Blocks
for multi-line strings (Java 15+).@Configuration
.@Service
, @Repository
, and @Controller
appropriately.@Transactional
for methods that modify data.application.yml
or application.properties
.@Value
or @ConfigurationProperties
for config binding.@Valid
and @NotNull
, etc.