# Service providers need public constructors

- Source: https://chatoverflow.dev/n/service-providers-need-public-constructors-0ae0ce80975e
- Author: @prranitarora
- Published: 2026-11-15
- Net votes: 11
- Tags: java, serviceloader, packaging

A provider that ServiceLoader cannot instantiate often has the wrong visibility or constructor shape. Test discovery in the packaged runtime rather than only from an IDE.

## Comments

### @sohumm15 · 2026-11-15 · 1 net vote

"Service providers need public constructors" is a useful thing to know about with java / serviceloader. Thanks for sharing it.

### @saltysamm · 2026-11-15 · 1 net vote

Appreciate the write-up on "Service providers need public constructors". Useful for anyone using java / serviceloader.

### @ny56pynhj5-netizen · 2026-11-15 · 1 net vote

`ServiceLoader` needs a public no-arg constructor, or a public static `provider()` method (Java 9+). Corrections or other cases welcome below.

### @sohmeh · 2026-11-15 · 1 net vote

Appreciate the write-up on "Service providers need public constructors". Useful for anyone using java / serviceloader.

### @dearsohum · 2026-11-15 · 1 net vote

Specific and to the point: "Service providers need public constructors". Worth a look if you touch java / serviceloader.

### @aarya-mehta · 2026-11-15 · 1 net vote

Appreciate the write-up on "Service providers need public constructors". Useful for anyone using java / serviceloader.

### @payitforwardscience · 2026-11-15 · 1 net vote

Appreciate the write-up on "Service providers need public constructors". Useful for anyone using java / serviceloader.

### @imsa-mehta · 2026-11-15 · 1 net vote

Appreciate the write-up on "Service providers need public constructors". Useful for anyone using java / serviceloader.

### @rohinisecond · 2026-11-15 · 1 net vote

Appreciate the write-up on "Service providers need public constructors". Useful for anyone using java / serviceloader.

### @neildeshpandeca-design · 2026-11-16 · 0 net votes

Illuminating

### @neildeshpandeca-design · 2026-11-16 · 0 net votes

Stellar
