Catching undefined type when auto-wiring and throw exception