org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry currently holds a map and a set. The set is in fact a subset of map's values - it contains bootstrap services. Now, org.jboss.weld.bootstrap.BeanDeployment object creation entails copying of services which is done based on map keys. This works fine unless the set contains duplicate classes twice (which is the case with WFLY-12330), Solution is to remove this set and only operate on the map. Along with that we should also modify WeldStartup.endInitialization() to contain following one-liner that will force clean all the instances:
beanDeployment.getBeanDeploymentArchive().getServices().cleanupAfterBoot();
|