Spring Boot
DNS Resolution
Apple M1
Troubleshooting
Software Development

Spring Boot 2.4.2 - DNS Resolution Problem at start on Apple M1

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

When Spring Boot appears to hang or fail during DNS resolution on Apple M1 at startup, the real problem is usually lower in the stack than Spring itself. In practice, it is often a combination of older Java builds, native networking libraries, or architecture mismatches on Apple Silicon rather than a pure Spring Boot configuration bug.

Separate Spring from the Network Stack

Spring Boot starts many components, but DNS lookup typically happens in the JDK, the operating system resolver, or a networking library such as Netty. That means the first step is to confirm whether simple hostname lookup already has trouble outside the full application.

A quick Java check looks like this:

java
1import java.net.InetAddress;
2
3public class DnsCheck {
4    public static void main(String[] args) throws Exception {
5        InetAddress address = InetAddress.getByName("localhost");
6        System.out.println(address.getHostAddress());
7    }
8}

If this tiny program is slow or fails, the issue is broader than Spring Boot startup.

Check the JDK and Architecture First

On Apple M1, old or mismatched Java installations caused many early compatibility problems. Make sure the runtime matches the machine architecture and is not accidentally running through an older compatibility path.

Useful checks:

bash
java -version
uname -m

If the machine is arm64 but the Java setup is old, unusual, or mixed with Intel-targeted tooling, DNS and native networking problems become more plausible.

Watch for Library-Level DNS Resolvers

Some Spring Boot applications pull in libraries that replace or augment the default resolver behavior. A common example is Netty-based networking stacks. If a native macOS resolver library is missing or mismatched for Apple Silicon, startup warnings or DNS failures can surface while the app initializes clients.

That is why one fix path is often:

  • upgrade the JDK
  • upgrade Spring Boot and dependent networking libraries
  • verify that native resolver dependencies match the machine architecture

The exact package coordinates vary by dependency stack, but the architectural principle stays the same.

Reduce the Problem to a Minimal Reproduction

Before changing many settings, strip the problem down:

  1. run a tiny Java DNS test
  2. run the Spring Boot app with minimal external integrations
  3. add back the networking clients one by one

That tells you whether the failure belongs to the core runtime, a resolver library, or some startup code that performs remote lookups too early.

Prefer Upgrading Over Deep Workarounds

Because the issue is tied to an older Spring Boot release on a new hardware architecture, upgrading is often more reliable than piling on system-property workarounds. If you stay pinned to the older stack, document the exact JDK, dependency versions, and machine architecture that reproduce the issue so the behavior stays understandable.

In other words, treat the problem as a compatibility boundary, not just a Spring property tweak.

Common Pitfalls

  • Blaming Spring Boot alone when DNS resolution is actually failing in the JDK, OS resolver, or a networking library.
  • Debugging only the full application instead of first testing basic hostname resolution with a minimal Java program.
  • Running an outdated or mismatched Java environment on Apple Silicon.
  • Ignoring transitive networking dependencies such as Netty that may use architecture-specific native resolver components.
  • Adding random workaround flags before identifying whether the problem is runtime, dependency, or configuration related.

Summary

  • Startup DNS issues on Apple M1 are often lower-level compatibility problems rather than pure Spring Boot bugs.
  • Test hostname resolution with a minimal Java program first.
  • Verify JDK version and architecture alignment on Apple Silicon.
  • Check whether networking libraries introduce native resolver dependencies.
  • Prefer dependency and runtime upgrades over ad hoc startup workarounds when possible.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.