Posts

Showing posts from July, 2026

Resolver for token headers

 Header values in class:  @Data  @Builder  @NoArgsConstructor  @AllArgsConstructor  public class UserClaims {        private Long userId;      private String customerId;      private String taxId;      private Boolean isDirector;      private String personalCode;  } Resolver class:  import jakarta.servlet.http.HttpServletRequest;  import java.util.Objects;  import org.apache.commons.lang3.StringUtils;  import org.springframework.core.MethodParameter;  import org.springframework.web.bind.MissingRequestHeaderException;  import org.springframework.web.bind.support.WebDataBinderFactory;  import org.springframework.web.context.request.NativeWebRequest;  import org.springframework.web.method.support.HandlerMethodArgumentResolver;  import org.springframework.web.method.support.ModelAndViewContainer;      public class User...

AuditableDate for entities in jpa

 import jakarta.persistence.Column;  import jakarta.persistence.EntityListeners;  import jakarta.persistence.MappedSuperclass;  import java.io.Serial;  import java.io.Serializable;  import java.time.LocalDateTime;  import lombok.Getter;  import lombok.Setter;  import org.springframework.data.annotation.CreatedDate;  import org.springframework.data.annotation.LastModifiedDate;  import org.springframework.data.jpa.domain.support.AuditingEntityListener;    @Getter  @Setter  @MappedSuperclass  @EntityListeners(AuditingEntityListener.class)  public class AuditableDate implements Serializable {        @Serial      private static final long serialVersionUID = 1L;        @CreatedDate      @Column(updatable = false)      private LocalDateTime createdAt;        @LastModifiedDate      private Loc...

Spring boot kafka job example

application-kafka.yml file:  spring:    kafka:      listener:        ack-mode: manual      consumer:        key-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer        value-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer        properties:          spring.json.use.type.headers: false          spring.json.trusted.packages: com.example.*          spring.deserializer.key.delegate.class: org.apache.kafka.common.serialization.StringDeserializer          spring.deserializer.value.delegate.class: org.springframework.kafka.support.serializer.JsonDeserializer        auto-offset-reset: latest        enable-auto-commit: false        operation-re...