java

java
package com.example.demo.dto;

import com.example.demo.validation.UniqueEmail;
import jakarta.validation.constraints.*;
import lombok.Data;

Validation with Bean Validation API

java validation bean-validation
by David Kumar 3 tabs
java
package com.example.demo.scheduled;

import com.example.demo.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;

Scheduled tasks with @Scheduled

java spring-boot scheduling
by David Kumar 2 tabs
java
package com.example.demo.service;

import com.example.demo.model.Order;
import com.example.demo.model.OrderItem;
import com.example.demo.model.User;
import com.example.demo.repository.OrderRepository;

Database transactions and isolation levels

java spring-boot transactions
by David Kumar 2 tabs
java
package com.example.demo.feature;

import org.togglz.core.Feature;
import org.togglz.core.annotation.EnabledByDefault;
import org.togglz.core.annotation.Label;
import org.togglz.core.context.FeatureContext;

Feature flags for gradual rollouts

java feature-flags togglz
by David Kumar 4 tabs
java
package com.example.demo.batch;

import com.example.demo.model.User;
import com.example.demo.model.UserDTO;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;

Batch processing with Spring Batch

java spring-batch batch-processing
by David Kumar 2 tabs
java
package com.example.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;

CORS configuration for cross-origin requests

java spring-boot cors
by David Kumar 2 tabs
dockerfile
# Build stage
FROM maven:3.9-eclipse-temurin-21 AS build
WORKDIR /app

# Copy dependency definitions
COPY pom.xml .

Docker containerization for Spring Boot

java docker spring-boot
by David Kumar 3 tabs
java
package com.example.demo.interceptor;

import io.github.bucket4j.Bandwidth;
import io.github.bucket4j.Bucket;
import io.github.bucket4j.Refill;
import jakarta.servlet.http.HttpServletRequest;

Rate limiting and API throttling

java rate-limiting bucket4j
by David Kumar 3 tabs
java
package com.example.demo.service;

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Timer;
import org.springframework.stereotype.Service;

Actuator for production monitoring

java spring-boot actuator
by David Kumar 4 tabs
java
package com.example.demo.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

Microservices with Spring Cloud

java spring-cloud microservices
by David Kumar 3 tabs
java
package com.example.demo.dto;

import java.time.LocalDateTime;
import java.util.List;

// Simple record

Record types for immutable data

java records immutable
by David Kumar 2 tabs
java
package com.example.demo.controller;

import com.example.demo.dto.PageResponse;
import com.example.demo.dto.UserDTO;
import com.example.demo.model.User;
import com.example.demo.service.UserService;

Pagination and sorting with Spring Data

java spring-data pagination
by David Kumar 2 tabs