use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-security-oauth by spring-projects.
the class ProviderBeanDefinitionParser method parseInternal.
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
String tokenServicesRef = element.getAttribute("token-services-ref");
String serializerRef = element.getAttribute("serialization-service-ref");
if (!StringUtils.hasText(tokenServicesRef)) {
tokenServicesRef = "oauth2TokenServices";
BeanDefinitionBuilder tokenServices = BeanDefinitionBuilder.rootBeanDefinition(DefaultTokenServices.class);
AbstractBeanDefinition tokenStore = BeanDefinitionBuilder.rootBeanDefinition(InMemoryTokenStore.class).getBeanDefinition();
tokenServices.addPropertyValue("tokenStore", tokenStore);
parserContext.getRegistry().registerBeanDefinition(tokenServicesRef, tokenServices.getBeanDefinition());
}
return parseEndpointAndReturnFilter(element, parserContext, tokenServicesRef, serializerRef);
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-boot by spring-projects.
the class WebFilterHandler method doHandle.
@Override
public void doHandle(Map<String, Object> attributes, ScannedGenericBeanDefinition beanDefinition, BeanDefinitionRegistry registry) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(FilterRegistrationBean.class);
builder.addPropertyValue("asyncSupported", attributes.get("asyncSupported"));
builder.addPropertyValue("dispatcherTypes", extractDispatcherTypes(attributes));
builder.addPropertyValue("filter", beanDefinition);
builder.addPropertyValue("initParameters", extractInitParameters(attributes));
String name = determineName(attributes, beanDefinition);
builder.addPropertyValue("name", name);
builder.addPropertyValue("servletNames", attributes.get("servletNames"));
builder.addPropertyValue("urlPatterns", extractUrlPatterns("urlPatterns", attributes));
registry.registerBeanDefinition(name, builder.getBeanDefinition());
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-boot by spring-projects.
the class WebListenerHandler method doHandle.
@Override
protected void doHandle(Map<String, Object> attributes, ScannedGenericBeanDefinition beanDefinition, BeanDefinitionRegistry registry) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(ServletListenerRegistrationBean.class);
builder.addPropertyValue("listener", beanDefinition);
registry.registerBeanDefinition(beanDefinition.getBeanClassName(), builder.getBeanDefinition());
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-framework by spring-projects.
the class ComponentBeanDefinitionParser method parseComponentElement.
private static AbstractBeanDefinition parseComponentElement(Element element) {
BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ComponentFactoryBean.class);
factory.addPropertyValue("parent", parseComponent(element));
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "component");
if (childElements != null && childElements.size() > 0) {
parseChildComponents(childElements, factory);
}
return factory.getBeanDefinition();
}
use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project spring-framework by spring-projects.
the class ComponentBeanDefinitionParser method parseComponent.
private static BeanDefinition parseComponent(Element element) {
BeanDefinitionBuilder component = BeanDefinitionBuilder.rootBeanDefinition(Component.class);
component.addPropertyValue("name", element.getAttribute("name"));
return component.getBeanDefinition();
}
Aggregations