Is it possible to inject interface with angular2?

No, interfaces are not supported for DI. With TypeScript interfaces are not available at runtime anymore, only statically and therefore can’t be used as DI tokens. Alternatively you can use strings as keys or InjectionToken provide(‘CoursesServiceInterface’, {useClass: CoursesServiceMock}) // old providers: [{provide: ‘CoursesServiceInterface’, useClass: CoursesServiceMock}] and inject it like constructor(@Inject(‘CoursesServiceInterface’) private coursesService:CoursesServiceInterface) {} See also … Read more

What is the difference between @Inject and @Autowired in Spring Framework? Which one to use under what condition?

Assuming here you’re referring to the javax.inject.Inject annotation. @Inject is part of the Java CDI (Contexts and Dependency Injection) standard introduced in Java EE 6 (JSR-299), read more. Spring has chosen to support using the @Inject annotation synonymously with their own @Autowired annotation. So, to answer your question, @Autowired is Spring’s own annotation. @Inject is … Read more

inject bean reference into a Quartz job in Spring?

You can use this SpringBeanJobFactory to automatically autowire quartz objects using spring: import org.quartz.spi.TriggerFiredBundle; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.scheduling.quartz.SpringBeanJobFactory; public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware { private transient AutowireCapableBeanFactory beanFactory; @Override public void setApplicationContext(final ApplicationContext context) { beanFactory = context.getAutowireCapableBeanFactory(); } @Override protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception { … Read more