@SuppressWarnings("unchecked")
protected RequiredRolesProvider getProviderInstance(final Class<? extends RequiredRolesProvider> providerType) {
final Bean<?> resolvedBean = beanManager.resolve(beanManager.getBeans(providerType));
final CreationalContext<?> creationalContext = beanManager.createCreationalContext(resolvedBean);
RequiredRolesProvider provider = (RequiredRolesProvider) beanManager.getReference(resolvedBean, providerType,
creationalContext);
if (resolvedBean.getScope().equals(Dependent.class)) {
dependentProviders.put(provider, new BeanDef((Bean<RequiredRolesProvider>) resolvedBean,
(CreationalContext<RequiredRolesProvider>) creationalContext));