Skip to content

Instantly share code, notes, and snippets.

View robsonkades's full-sized avatar
🎯
Focusing

Robson Kades robsonkades

🎯
Focusing
View GitHub Profile
spring:
devtools:
restart:
enabled: false
application:
name: MyApp
datasource:
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
import tools.jackson.core.StreamReadFeature;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.DeserializationFeature;
import tools.jackson.databind.MapperFeature;
import tools.jackson.databind.PropertyNamingStrategies;
import tools.jackson.databind.SerializationFeature;
import tools.jackson.databind.cfg.DateTimeFeature;
import tools.jackson.databind.cfg.EnumFeature;
import tools.jackson.databind.json.JsonMapper;
https://medium.com/javarevisited/one-endpoint-multiple-payloads-handling-polymorphic-request-bodies-in-spring-boot-4e354b72450c
https://medium.com/@khanjani.hamid/advanced-jvm-heap-tuning-and-kubernetes-optimization-for-high-performance-java-applications-998b6604c70a
import com.ctc.wstx.api.WstxInputProperties;
import com.ctc.wstx.stax.WstxInputFactory;
import com.ctc.wstx.stax.WstxOutputFactory;
import com.fleekdocs.infrastructure.exception.XmlException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.RemovalCause;
import org.springframework.cache.CacheManager;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.Duration;
@Configuration
import org.springframework.boot.ssl.SslBundle;
import org.springframework.boot.ssl.SslBundleKey;
import org.springframework.boot.ssl.SslBundleRegistry;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.boot.ssl.jks.JksSslStoreBundle;
import org.springframework.boot.ssl.jks.JksSslStoreDetails;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
record StatusTransition(InvoiceStatus current) {
public void validate(InvoiceStatus next, String invoiceId) {
if (!current.canTransitionTo(next)) {
throw DomainException.with(Message.INVOICE_TRANSITION_NOT_ALLOWED, invoiceId, current, next);
}
}
}
import org.springframework.stereotype.Component;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.Serial;
import java.io.StringReader;
import java.util.ArrayDeque;
import org.springframework.web.client.RestClient;
public record WebServiceClient(RestClient restClient, CloseableResources closeableResources) {
}
import org.springframework.http.ResponseEntity;
import java.util.concurrent.CompletableFuture;
public interface WebService {
@RestController
@RequestMapping
public class MessageController {
private final AzureServiceBusTemplate serviceBusTemplate;
public MessageController(AzureServiceBusTemplate azureServiceBusTemplate) {
this.serviceBusTemplate = azureServiceBusTemplate;
}
@PostMapping
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import org.springframework.data.redis.connection.RedisConnectionFactory;