private <T> ManagedBeanService<T> createManagedBeanService(final Class<T> beanClass, final ClassLoader classLoader, final ManagedBeanConfiguration managedBeanConfiguration, List<ResourceInjection<?>> resourceInjections, final List<ManagedBeanInterceptor<?>> interceptors) {
return new ManagedBeanService<T>(new ManagedBeanContainer<T>(beanClass, classLoader, managedBeanConfiguration.getPostConstructMethods(), managedBeanConfiguration.getPreDestroyMethods(), resourceInjections, interceptors));
}
private <T> ResourceInjection<T> processResource(final DeploymentUnitContext deploymentContext, final ModuleContextConfig moduleContext, final Class<T> valueType, final ResourceConfiguration resourceConfiguration, final BatchBuilder batchBuilder, final BatchServiceBuilder<?> serviceBuilder, final ServiceName beanContextServiceName, final JndiName managedBeanContextJndiName) throws DeploymentUnitProcessingException {
final JndiName localContextName = managedBeanContextJndiName.append(resourceConfiguration.getLocalContextName());
final String targetContextName = resourceConfiguration.getTargetContextName();
final NamingLookupValue<T> lookupValue = new NamingLookupValue<T>(localContextName);
final ResourceInjection<T> resourceInjection = getResourceInjection(resourceConfiguration, lookupValue);
// Now add a binder for the local context
final ServiceName binderName = beanContextServiceName.append(localContextName.getLocalName());
if(resourceInjection != null) {
serviceBuilder.addDependency(binderName);
serviceBuilder.addDependency(beanContextServiceName, Context.class, lookupValue.getContextInjector());
}