use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project cucumber-jvm by cucumber.
the class CucumberTestContextManager method registerStepClassBeanDefinition.
private void registerStepClassBeanDefinition(ConfigurableListableBeanFactory beanFactory, Class<?> stepClass) {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
BeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition(stepClass).setScope(GlueCodeScope.NAME).getBeanDefinition();
registry.registerBeanDefinition(stepClass.getName(), beanDefinition);
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-framework by spring-projects.
the class PrototypeTargetSourceTests method setUp.
@Before
public void setUp() throws Exception {
this.beanFactory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader((BeanDefinitionRegistry) this.beanFactory).loadBeanDefinitions(CONTEXT);
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-boot by spring-projects.
the class ResourceServerTokenServicesConfigurationTests method userInfoWithClient.
@Test
public void userInfoWithClient() {
EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.client.client-id=acme", "security.oauth2.resource.userInfoUri:http://example.com", "server.port=-1", "debug=true");
this.context = new SpringApplicationBuilder(ResourceNoClientConfiguration.class).environment(this.environment).web(WebApplicationType.SERVLET).run();
BeanDefinition bean = ((BeanDefinitionRegistry) this.context).getBeanDefinition("scopedTarget.oauth2ClientContext");
assertThat(bean.getScope()).isEqualTo("request");
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project cuba by cuba-platform.
the class RemoteProxyBeanCreator method processSubstitutions.
protected void processSubstitutions(ConfigurableListableBeanFactory beanFactory) {
if (substitutions != null) {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
for (Map.Entry<String, String> entry : substitutions.entrySet()) {
// replace bean with substitution bean
if (beanFactory.containsBean(entry.getKey())) {
String beanName = entry.getKey();
String beanClass = entry.getValue();
BeanDefinition definition = new RootBeanDefinition(beanClass);
MutablePropertyValues propertyValues = definition.getPropertyValues();
propertyValues.add("substitutedBean", beanFactory.getBean(beanName));
registry.registerBeanDefinition(beanName, definition);
}
}
}
}
use of org.springframework.beans.factory.support.BeanDefinitionRegistry in project spring-data-mongodb by spring-projects.
the class MongoAuditingBeanDefinitionParser method doParse.
/*
* (non-Javadoc)
* @see org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder)
*/
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
String mappingContextRef = element.getAttribute("mapping-context-ref");
if (!StringUtils.hasText(mappingContextRef)) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
if (!registry.containsBeanDefinition(MAPPING_CONTEXT_BEAN_NAME)) {
registry.registerBeanDefinition(MAPPING_CONTEXT_BEAN_NAME, new RootBeanDefinition(MongoMappingContext.class));
}
mappingContextRef = MAPPING_CONTEXT_BEAN_NAME;
}
IsNewAwareAuditingHandlerBeanDefinitionParser parser = new IsNewAwareAuditingHandlerBeanDefinitionParser(mappingContextRef);
parser.parse(element, parserContext);
builder.addConstructorArgValue(getObjectFactoryBeanDefinition(parser.getResolvedBeanName(), parserContext.extractSource(element)));
}
Aggregations