1
Eclipse E4 DI 기능을 사용하여 사용자 정의 서비스/제공자를 주입하는 방법을 설명해 주실 수 있습니까?E4 애플리케이션에서 커스텀 싱글 톤 빈을 주입하는 방법은 무엇입니까?
@Singleton
public class ConnectionPool {
// should be a singleton
}
public class MyService implements IMyService {
@Inject
ConnectionPool pool;
}
// referenced in application model
public class SamplePart {
@Inject
IMyService myService;
@PostConstruct
public void createComposite(Composite parent) {
myService.doSomething();
}
}
아니면 이클립스 DI와 함께 (예를 들어) 구글 Guice을 사용할 수 있습니까?
나는 몇 가지 예를 시도 ( this을 같은)하지만 당신은ConnectionPool
에
@Creatable
주석 (
org.eclipse.e4.core.di.annotations.Creatable
) 추가 할 필요가