
How to Write Your Own Spring Boot Starter Step by Step
Write a Spring Boot starter in two modules: an auto configuration with properties and conditions, and a thin starter that pulls it in with its dependencies.
Tag
223 posts

Write a Spring Boot starter in two modules: an auto configuration with properties and conditions, and a thin starter that pulls it in with its dependencies.

Organise Java packages by feature instead of by layer: a layout for Spring Boot, package private visibility, shared code rules and a path to modules.

Prevent server side request forgery in Java: allowlists for outbound URLs, blocking private and metadata addresses, DNS rebinding and redirect handling.

Write a ThreadFactory that names threads, sets daemon status and an uncaught exception handler, so dumps and logs show which pool a thread is in.

How the JVM reads container limits: MaxRAMPercentage, InitialRAMPercentage, MinRAMPercentage, availableProcessors and how to confirm what the JVM sees.

Replace a bean with a Mockito mock in a Quarkus test using @InjectMock, understand scope rules, Mockito.when stubs and when to use alternatives or a CDI mock.

Run JSF pages inside Spring Boot: the JoinFaces starter, Mojarra setup, Spring beans in EL, scopes, Spring Security login and packaging as a jar.

Generate tests at runtime in JUnit with TestFactory, DynamicTest and DynamicContainer, and learn how they differ from parameterized tests.

Set up Java remote debugging with the JDWP agent, connect from jdb or an IDE, reach a container or Kubernetes pod safely and avoid exposing the port.

Disable spring.jpa.open-in-view safely: find lazy loads outside a transaction, fix them with fetch joins and DTO projections, and prove it with tests.

Exclude a Spring Boot auto configuration class with an annotation or property, and learn when a custom bean or a profile is the better tool.

Model money, time ranges and identifiers as value objects in Java with records, validation in the constructor, immutability and equality by value.