Video in progress
Should you build a shared internal starter (a platform library) for all Spring services in the company? How do you weigh the benefits and risks?
Yes, if it standardizes the cross-cutting concerns (log format, tracing, security, error format, HTTP client defaults) and services can override it. The risk is a "god library" that couples everyone together, forced upgrades, and one bug spreading to every service. With small, versioned, optional modules, the benefit is large.
📖 Answer
What goes into the platform: the log format (JSON, trace id, masking of sensitive fields), tracing and metrics settings with common tags, the resource server configuration and audience, the ProblemDetail error format and a shared exception handler, RestClient.Builder defaults (timeout, retry, correlation headers), Actuator settings and health groups.
What doesn't: business logic, domain models and a grab bag of "useful for everyone" utilities.
How to build it:
- auto-configuration +
@ConditionalOnMissingBean, so each service can replace a default; - several small starters (
platform-logging,platform-security), not one big library; - a BOM: the service only picks the platform version, and the matching Spring Boot version comes with it;
- semver and a changelog, with breaking changes only in a major version;
- minimal transitive dependencies, so services don't get unneeded jars dragged in;
- auto-configurations are tested with
ApplicationContextRunner.
The organizational side matters as much as the technical one. You need a team that owns the library, an upgrade policy (for example, at most two versions behind) and automatic Renovate PRs. A platform library with no owner soon becomes old code that everyone is afraid to touch.
Sign up to mark studied questions and save your progress.