<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Spring-Boot on Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/tags/spring-boot/</link><description>Recent content in Spring-Boot on Java &amp; Software Architecture Knowledge Hub</description><generator>Hugo</generator><language>en-US</language><copyright>© 2026 Samir Kumar Sahoo (https://github.com/samirsahoo). All rights reserved.</copyright><atom:link href="https://samirsahoo.github.io/design-patterns-hub/tags/spring-boot/index.xml" rel="self" type="application/rss+xml"/><item><title>Spring Boot Auto-Configuration and @ConditionalOn* Annotations</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/boot/auto-configuration-and-conditions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/boot/auto-configuration-and-conditions/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Auto-configuration&lt;/strong&gt; is Spring Boot&amp;rsquo;s mechanism for registering &lt;strong&gt;sensible default beans&lt;/strong&gt; based on what is on the classpath, which beans you have already defined, and your properties. Each default is guarded by &lt;strong&gt;conditions&lt;/strong&gt; (&lt;code&gt;@ConditionalOn…&lt;/code&gt;), so it &lt;strong&gt;backs off&lt;/strong&gt; as soon as you configure your own.&lt;/p&gt;</description></item><item><title>Saga Pattern: Choreography versus Orchestration</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/saga-pattern/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/saga-pattern/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;saga&lt;/strong&gt; is a sequence of &lt;strong&gt;local transactions&lt;/strong&gt;, one per service. Each step commits in its own database and triggers the next. If a step fails, the saga runs &lt;strong&gt;compensating transactions&lt;/strong&gt; that semantically undo the steps already completed. Sagas give microservices business-level consistency without a distributed transaction.&lt;/p&gt;</description></item><item><title>Externalized Configuration and @ConfigurationProperties</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/boot/externalized-configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/boot/externalized-configuration/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Externalized configuration&lt;/strong&gt; keeps environment-specific values (URLs, credentials, limits, feature flags) &lt;strong&gt;outside the code&lt;/strong&gt;, so the &lt;strong&gt;same artifact&lt;/strong&gt; runs in development, test and production. Spring Boot merges many &lt;strong&gt;property sources&lt;/strong&gt; into one &lt;code&gt;Environment&lt;/code&gt;, and binds values into type-safe objects with &lt;strong&gt;&lt;code&gt;@ConfigurationProperties&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Idempotency: Safe Retries for APIs and Consumers</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/reliability/idempotency/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/reliability/idempotency/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An operation is &lt;strong&gt;idempotent&lt;/strong&gt; if performing it several times has the same effect as performing it once. Idempotency is what makes &lt;strong&gt;retries safe&lt;/strong&gt;: and in distributed systems retries are unavoidable, because a timeout never tells you whether the operation happened.&lt;/p&gt;</description></item><item><title>Integration Testing with @SpringBootTest, Test Slices and Testcontainers</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/production/integration-testing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/production/integration-testing/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An &lt;strong&gt;integration test&lt;/strong&gt; checks that components &lt;strong&gt;work together with real infrastructure and framework behaviour&lt;/strong&gt;: HTTP mapping and JSON, transactions and SQL, security rules, messaging. Spring Boot provides &lt;strong&gt;&lt;code&gt;@SpringBootTest&lt;/code&gt;&lt;/strong&gt; for the whole application and &lt;strong&gt;test slices&lt;/strong&gt; for one layer. &lt;strong&gt;Testcontainers&lt;/strong&gt; starts &lt;strong&gt;real&lt;/strong&gt; databases and brokers in Docker for tests.&lt;/p&gt;</description></item><item><title>Spring Boot Service Review Checklist</title><link>https://samirsahoo.github.io/design-patterns-hub/self-review/service-review-checklist/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/self-review/service-review-checklist/</guid><description>&lt;h2 id="how-to-use-it"&gt;How to use it&lt;a class="heading-anchor" href="#how-to-use-it" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Review your own service before release, or a team&amp;rsquo;s service at a production-readiness review. Score each area 0–3 and note evidence (links to code, tests, dashboards).&lt;/p&gt;&#10;&lt;figure class="diagram" aria-label="Nine review areas"&gt;&lt;figcaption class="diagram__title"&gt;Nine review areas&lt;/figcaption&gt;&#10; &lt;pre class="mermaid"&gt;flowchart LR&#10; A1[&amp;#34;1 · Java &amp;amp; code&amp;#34;] --&amp;gt; A2[&amp;#34;2 · Spring config&amp;#34;] --&amp;gt; A3[&amp;#34;3 · API&amp;#34;] --&amp;gt; A4[&amp;#34;4 · Data &amp;amp; tx&amp;#34;] --&amp;gt; A5[&amp;#34;5 · Security&amp;#34;]&#10; A5 --&amp;gt; A6[&amp;#34;6 · Resilience&amp;#34;] --&amp;gt; A7[&amp;#34;7 · Observability&amp;#34;] --&amp;gt; A8[&amp;#34;8 · Testing&amp;#34;] --&amp;gt; A9[&amp;#34;9 · Operations&amp;#34;]&lt;/pre&gt;&#10;&lt;/figure&gt;&#10;&lt;h2 id="1-java-and-code"&gt;1. Java and code&lt;a class="heading-anchor" href="#1-java-and-code" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Immutable value objects and records; no shared mutable state in singletons?&lt;/li&gt;&#10;&lt;li&gt;Executors bounded and named; no blocking in the common ForkJoinPool; virtual threads considered for I/O?&lt;/li&gt;&#10;&lt;li&gt;Exceptions chained, translated at boundaries, never swallowed?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; raw types; &lt;code&gt;catch (Exception e) {}&lt;/code&gt;; &lt;code&gt;synchronized&lt;/code&gt; around blocking I/O on Java 21–23; unbounded caches.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="2-spring-configuration"&gt;2. Spring configuration&lt;a class="heading-anchor" href="#2-spring-configuration" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Constructor injection throughout; no circular dependencies?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@ConfigurationProperties&lt;/code&gt; records with validation; no secrets in &lt;code&gt;application.yml&lt;/code&gt;?&lt;/li&gt;&#10;&lt;li&gt;Auto-configuration customised through properties or customisers rather than exclusions?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; field injection everywhere; &lt;code&gt;@EnableWebMvc&lt;/code&gt; in Boot; logic branching on profiles.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="3-api-design"&gt;3. API design&lt;a class="heading-anchor" href="#3-api-design" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Resource URIs, correct methods and status codes; 201 + &lt;code&gt;Location&lt;/code&gt; on create?&lt;/li&gt;&#10;&lt;li&gt;Validation at the edge; DTOs, not entities; pagination?&lt;/li&gt;&#10;&lt;li&gt;Errors as RFC 9457 Problem Details through &lt;code&gt;@RestControllerAdvice&lt;/code&gt;; no stack traces?&lt;/li&gt;&#10;&lt;li&gt;Idempotency keys for non-idempotent operations; versioning strategy?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; 200 with error bodies; returning JPA entities; retrying POSTs.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="4-persistence-and-transactions"&gt;4. Persistence and transactions&lt;a class="heading-anchor" href="#4-persistence-and-transactions" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;All associations LAZY; N+1 checked (query counts in tests); open-in-view disabled?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@Transactional&lt;/code&gt; on public service methods; rollback rules understood; no remote calls inside transactions?&lt;/li&gt;&#10;&lt;li&gt;Locking strategy for contended data (&lt;code&gt;@Version&lt;/code&gt; or &lt;code&gt;FOR UPDATE&lt;/code&gt;)?&lt;/li&gt;&#10;&lt;li&gt;Flyway or Liquibase migrations with &lt;code&gt;ddl-auto=validate&lt;/code&gt;; expand–contract for breaking changes?&lt;/li&gt;&#10;&lt;li&gt;Caches with TTLs, evicted after commit?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; EAGER &lt;code&gt;@ManyToOne&lt;/code&gt;; &lt;code&gt;ddl-auto=update&lt;/code&gt;; &lt;code&gt;@Transactional&lt;/code&gt; on private methods.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="5-security"&gt;5. Security&lt;a class="heading-anchor" href="#5-security" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;A SecurityFilterChain per area; deny by default; CSRF correct for the client type?&lt;/li&gt;&#10;&lt;li&gt;JWT validation with issuer and &lt;strong&gt;audience&lt;/strong&gt;; scopes and roles mapped?&lt;/li&gt;&#10;&lt;li&gt;Object-level checks (ownership or tenant) on every resource access (&lt;code&gt;@PreAuthorize&lt;/code&gt; or bean checks)?&lt;/li&gt;&#10;&lt;li&gt;Actuator on a separate port, with sensitive endpoints protected?&lt;/li&gt;&#10;&lt;li&gt;Dependencies scanned; secrets from a vault or secret manager?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; role checks only (BOLA); &lt;code&gt;permitAll&lt;/code&gt; before specific rules; tokens in localStorage.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="6-resilience"&gt;6. Resilience&lt;a class="heading-anchor" href="#6-resilience" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Timeouts on every outbound call (connect and read)?&lt;/li&gt;&#10;&lt;li&gt;Retries only on idempotent calls, with backoff and jitter; not at every layer?&lt;/li&gt;&#10;&lt;li&gt;Circuit breakers and bulkheads per dependency; safe fallbacks?&lt;/li&gt;&#10;&lt;li&gt;Outbox + idempotent consumers + DLQs for messaging?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; no HTTP client timeouts; infinite retries; &amp;ldquo;pretend success&amp;rdquo; fallbacks for payments.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="7-observability"&gt;7. Observability&lt;a class="heading-anchor" href="#7-observability" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Micrometer metrics (RED) with percentile histograms; business metrics?&lt;/li&gt;&#10;&lt;li&gt;Traces exported via OTLP; context propagated over HTTP and messaging?&lt;/li&gt;&#10;&lt;li&gt;Structured logs with trace IDs; no PII in logs?&lt;/li&gt;&#10;&lt;li&gt;SLOs with burn-rate alerts; dashboards per service?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; high-cardinality tags; logs without correlation; alerts on every spike.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="8-testing"&gt;8. Testing&lt;a class="heading-anchor" href="#8-testing" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Fast unit tests for domain logic (real objects and fakes; mocks at boundaries)?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@WebMvcTest&lt;/code&gt; for controllers (validation, errors, security)?&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;@DataJpaTest&lt;/code&gt; + Testcontainers on the real database engine; migrations tested?&lt;/li&gt;&#10;&lt;li&gt;A few &lt;code&gt;@SpringBootTest&lt;/code&gt; end-to-end flows; contract tests with consumers?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; H2 instead of the real database; &lt;code&gt;@SpringBootTest&lt;/code&gt; everywhere; flaky time-dependent tests.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="9-operations"&gt;9. Operations&lt;a class="heading-anchor" href="#9-operations" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Liveness and readiness probes correct (dependencies only in readiness); graceful shutdown?&lt;/li&gt;&#10;&lt;li&gt;Container memory sized (&lt;code&gt;MaxRAMPercentage&lt;/code&gt;); GC logs available?&lt;/li&gt;&#10;&lt;li&gt;Configuration externalised; one artifact for every environment?&lt;/li&gt;&#10;&lt;li&gt;Runbooks, on-call ownership, dependency and version upgrade plan (Java 25 LTS, Boot 4.x)?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Red flags:&lt;/strong&gt; heap equal to the container limit; database checks in liveness; unpatched framework versions.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="scoring-rubric"&gt;Scoring rubric&lt;a class="heading-anchor" href="#scoring-rubric" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;div class="table-wrap" tabindex="0" role="region" aria-label="Table"&gt;&#10;&lt;table&gt;&#10; &lt;thead&gt;&#10; &lt;tr&gt;&#10; &lt;th&gt;Score&lt;/th&gt;&#10; &lt;th&gt;Meaning&lt;/th&gt;&#10; &lt;/tr&gt;&#10; &lt;/thead&gt;&#10; &lt;tbody&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;0&lt;/td&gt;&#10; &lt;td&gt;Not considered&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;1&lt;/td&gt;&#10; &lt;td&gt;Considered, but not implemented&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;2&lt;/td&gt;&#10; &lt;td&gt;Implemented, but not verified&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;tr&gt;&#10; &lt;td&gt;3&lt;/td&gt;&#10; &lt;td&gt;Implemented and verified (tests, dashboards, drills)&lt;/td&gt;&#10; &lt;/tr&gt;&#10; &lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;A service is &lt;strong&gt;ready for production&lt;/strong&gt; with no zeros in areas 4–7 and an average of at least 2.&lt;/p&gt;</description></item><item><title>Hexagonal Architecture with Spring Boot</title><link>https://samirsahoo.github.io/design-patterns-hub/hexagonal-architecture/spring-boot-implementation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/hexagonal-architecture/spring-boot-implementation/</guid><description>&lt;h2 id="what-you-will-build"&gt;What you will build&lt;a class="heading-anchor" href="#what-you-will-build" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A small order service with two use cases — &lt;strong&gt;place an order&lt;/strong&gt; (and charge for it) and &lt;strong&gt;get an order&lt;/strong&gt; — structured as Ports and Adapters:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;The &lt;strong&gt;domain model&lt;/strong&gt; enforces business rules in plain Java.&lt;/li&gt;&#10;&lt;li&gt;The &lt;strong&gt;application service&lt;/strong&gt; orchestrates use cases and talks to the outside world only through &lt;strong&gt;ports&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Adapters&lt;/strong&gt; connect the core to HTTP (Spring MVC), a database (Spring Data JPA with H2) and a payment provider (simulated, so the example needs no credentials).&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Tests&lt;/strong&gt; cover each part at the right level. The use-case tests run without Spring and without a database.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The full source is in &lt;code&gt;examples/spring-hexagonal-orders/&lt;/code&gt;. It targets &lt;strong&gt;Java 21&lt;/strong&gt; and &lt;strong&gt;Spring Boot 4.1.1&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Transactional Outbox and Idempotent Inbox</title><link>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/transactional-outbox/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/microservices/data-consistency/transactional-outbox/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;strong&gt;transactional outbox&lt;/strong&gt; pattern publishes events reliably from a service that owns a database. Instead of writing to the database &lt;strong&gt;and&lt;/strong&gt; sending to a broker (two systems that cannot share a transaction), the service writes the business change &lt;strong&gt;and an outbox row&lt;/strong&gt; in &lt;strong&gt;one local transaction&lt;/strong&gt;. A separate relay later reads the outbox and publishes to the broker. The matching &lt;strong&gt;inbox&lt;/strong&gt; pattern lets consumers process each message once, even when it is delivered several times.&lt;/p&gt;</description></item><item><title>Spring Boot Actuator and Custom Endpoints</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/boot/actuator-and-custom-endpoints/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/boot/actuator-and-custom-endpoints/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Spring Boot Actuator&lt;/strong&gt; adds &lt;strong&gt;production-ready endpoints&lt;/strong&gt; that show whether an application is healthy, what it is doing, and how it is configured: health, metrics, info, loggers, environment, thread dumps and more. You can add your own health checks and endpoints.&lt;/p&gt;</description></item></channel></rss>