Şu satırı dahil ederiz
import javax.enterprise.inject.se.SeContainer; import javax.enterprise.inject.se.SeContainerInitializer;
Örnek
Şöyle yaparız
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {Vehicle vehicle = container.select(Vehicle.class).get();vehicle.move();Car car = container.select(Car.class).get();car.move();System.out.println("Is the same vehicle? " + car.equals(vehicle));}public interface Vehicle {void move();}@ApplicationScopedpublic class Car implements Vehicle {//... implementation here}
Hiç yorum yok:
Yorum Gönder