jdbc

sql
CREATE TABLE outbox_deliveries (
    id              BIGSERIAL PRIMARY KEY,
    dedupe_key      TEXT        NOT NULL,
    target_url      TEXT        NOT NULL,
    payload         JSONB       NOT NULL,
    status          TEXT        NOT NULL DEFAULT 'PENDING',

Reliable Webhook Delivery with a Transactional Outbox and Dedupe Key in Spring Boot

spring-boot webhooks outbox-pattern
by codesnips 3 tabs
java
public record User(Long id, String email, String displayName, boolean active) {

    public static User of(String email, String displayName) {
        return new User(null, email, displayName, true);
    }

Efficient JDBC Batch Inserts With addBatch, executeBatch, and Generated Keys

jdbc batch-insert postgres
by codesnips 3 tabs
java
@RestController
@RequestMapping("/api/transactions")
public class TransactionExportController {

    private final CsvExportService exportService;

Stream a Large CSV Export to the HTTP Response with StreamingResponseBody in Spring Boot

spring-boot streaming csv
by codesnips 3 tabs
java
@RestController
@RequestMapping("/api/customers")
public class CsvImportController {

    private final CsvImportService importService;

Streaming CSV Import in Spring Boot with MultipartFile and JDBC Batch Inserts

spring-boot csv jdbc
by codesnips 4 tabs
java
package com.example.health;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;

Custom Spring Boot Actuator Health Indicators for Database and Disk

spring-boot actuator health-check
by codesnips 3 tabs
java
@RestController
@RequestMapping("/api/exports")
public class ExportController {

    private final CsvStreamWriter csvStreamWriter;

Streaming a Large CSV Export in Spring Boot with StreamingResponseBody

spring-boot streaming csv
by codesnips 4 tabs
java
@Configuration
public class TxConfig {

    @Bean
    public PlatformTransactionManager transactionManager(DataSource dataSource) {
        DataSourceTransactionManager tm = new DataSourceTransactionManager(dataSource);

Multi-Step Order Flow With Spring TransactionTemplate and Savepoint Rollback

spring-boot transactions transactiontemplate
by codesnips 3 tabs