Use dependency injection for API to fix decoder_spec for JRuby