77
88import org .apache .camel .CamelContext ;
99import org .apache .camel .CamelContextAware ;
10- import org .apache .camel .ExtendedCamelContext ;
1110import org .apache .camel .impl .engine .DefaultInjector ;
1211import org .apache .camel .spi .CamelBeanPostProcessor ;
1312import org .apache .camel .spi .Injector ;
13+ import org .apache .camel .support .PluginHelper ;
1414
1515import io .jooby .Registry ;
1616import io .jooby .ServiceKey ;
1717import io .jooby .SneakyThrows ;
1818import io .jooby .exception .RegistryException ;
1919
2020public class JoobyInjector implements Injector {
21- private DefaultInjector defaultInjector ;
22- private Registry registry ;
21+ private final DefaultInjector defaultInjector ;
22+ private final Registry registry ;
2323 private final CamelContext camel ;
2424 private final CamelBeanPostProcessor postProcessor ;
2525
2626 public JoobyInjector (CamelContext camel , Registry registry ) {
2727 this .registry = registry ;
2828 this .camel = camel ;
29- this .postProcessor = camel . adapt ( ExtendedCamelContext . class ). getBeanPostProcessor ();
29+ this .postProcessor = PluginHelper . getBeanPostProcessor (camel );
3030 this .defaultInjector = new DefaultInjector (camel );
3131 }
3232
@@ -41,6 +41,11 @@ public <T> T newInstance(Class<T> type, String factoryMethod) {
4141 return defaultInjector .newInstance (type , factoryMethod );
4242 }
4343
44+ @ Override
45+ public <T > T newInstance (Class <T > type , Class <?> factoryClass , String factoryMethod ) {
46+ return defaultInjector .newInstance (type , factoryClass , factoryMethod );
47+ }
48+
4449 @ Override
4550 public <T > T newInstance (Class <T > type , boolean postProcessBean ) {
4651 T instance = require (ServiceKey .key (type ));
0 commit comments