macOS doesn’t give you a built-in toggle — but you can use a resolver config tweak. sudo nano /etc/gai.conf Add this..
precedence ::ffff:0:0/96 100
it will boosts IPv4 preference when resolving hostnames that return both A (IPv4) and AAAA (IPv6) records. (The file may not exist; if so, you’re creating it. It’s honored by getaddrinfo, which Java ultimately uses through the OS.)
Keeps IPv6 alive but prefers IPv4
TIL, thanks!
I don't see the point in applying such a hack when the problem is a DNS server that they themselves control. Fix/remove the AAAA record and the problem goes away without leaving a footgun on your system to hurt you years down the line by altering the network priority order.