The standard Exception has no default constructor (or a way to set the message after instantiation). If a custom exception is based on it, can the derived class be made injectable?
public class SpecialPurposeException extends Exception {
private static final long serialVersionUID = 1L;
public SpecialPurposeException(String message) {
super(message);
}
}
The custom exception will not normally be instantiated outside of its module, but for consistency reasons it should perhaps be injected inside of it.