private void configureGhost(BeanManager bm, BeanConfigurator<Ghost> ghost) { // creation using read from bean attributes ghost.read(bm.createBeanAttributes(bm.createAnnotatedType(Ghost.class))); ghost.beanClass(Ghost.class); ghost.addQualifier(Undead.UndeadLiteral.INSTANCE); ghost.addStereotype(Monster.class); ghost.scope(RequestScoped.class); // test replacement of IPs InjectionPoint ghostWeaponIP = null; InjectionPoint ghostDesireIP = null; for (AnnotatedField<? super Ghost> field : bm.createAnnotatedType(Ghost.class).getFields()) { if (field.getJavaMember().getType().equals(DesireToHurtHumans.class)) { ghostDesireIP = bm.createInjectionPoint(field); } if (field.getJavaMember().getType().equals(Weapon.class)) { ghostWeaponIP = bm.createInjectionPoint(field); } } // firstly add one IP, then replace it with other ghost.addInjectionPoint(ghostWeaponIP); ghost.injectionPoints(ghostDesireIP); // set producing ghost.produceWith(MonsterController.getGhostInstance); }