Tabnine Logo
org.springframework.beans.factory.support
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.beans.factory.support

Best Java code snippets using org.springframework.beans.factory.support (Showing top 20 results out of 4,878)

origin: spring-projects/spring-framework

/**
 * Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}.
 * @param beanClass the {@code Class} of the bean that the definition is being created for
 * @param instanceSupplier a callback for creating an instance of the bean
 * @since 5.0
 */
public static <T> BeanDefinitionBuilder genericBeanDefinition(Class<T> beanClass, Supplier<T> instanceSupplier) {
  BeanDefinitionBuilder builder = new BeanDefinitionBuilder(new GenericBeanDefinition());
  builder.beanDefinition.setBeanClass(beanClass);
  builder.beanDefinition.setInstanceSupplier(instanceSupplier);
  return builder;
}
origin: spring-projects/spring-framework

/**
 * Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}.
 * @param beanClass the {@code Class} of the bean that the definition is being created for
 */
public static BeanDefinitionBuilder genericBeanDefinition(Class<?> beanClass) {
  BeanDefinitionBuilder builder = new BeanDefinitionBuilder(new GenericBeanDefinition());
  builder.beanDefinition.setBeanClass(beanClass);
  return builder;
}
origin: spring-projects/spring-framework

/**
 * Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}.
 * @param beanClassName the class name for the bean that the definition is being created for
 */
public static BeanDefinitionBuilder genericBeanDefinition(String beanClassName) {
  BeanDefinitionBuilder builder = new BeanDefinitionBuilder(new GenericBeanDefinition());
  builder.beanDefinition.setBeanClassName(beanClassName);
  return builder;
}
origin: spring-projects/spring-framework

private void registerMisconfiguredBeanDefinition(BeanDefinitionRegistry registry) {
  registry.registerBeanDefinition("misconfigured",
    rootBeanDefinition(Object.class).addPropertyValue("nonexistent", "bogus")
      .getBeanDefinition());
}
origin: spring-projects/spring-framework

@Test(expected = IllegalStateException.class)
public void testScopingBeanToUnregisteredScopeResultsInAnException() {
  BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(TestBean.class);
  AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
  beanDefinition.setScope("he put himself so low could hardly look me in the face");
  DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
  factory.registerBeanDefinition("testBean", beanDefinition);
  factory.getBean("testBean");
}
origin: spring-projects/spring-framework

@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
  registry.registerBeanDefinition("anotherpp", new RootBeanDefinition(TestBeanDefinitionRegistryPostProcessor.class));
  registry.registerBeanDefinition("ppp", new RootBeanDefinition(PrioritizedBeanDefinitionRegistryPostProcessor.class));
}
origin: spring-projects/spring-framework

@Before
public void setUp() {
  bf = new DefaultListableBeanFactory();
  bf.registerBeanDefinition("foo", new RootBeanDefinition(FooFactoryBean.class));
  bf.addBeanPostProcessor(new PredictingBPP());
}
origin: spring-projects/spring-framework

/**
 * Create a new {@code BeanDefinitionBuilder} used to construct a {@link RootBeanDefinition}.
 * @param beanClass the {@code Class} of the bean that the definition is being created for
 * @param factoryMethodName the name of the method to use to construct the bean instance
 */
public static BeanDefinitionBuilder rootBeanDefinition(Class<?> beanClass, @Nullable String factoryMethodName) {
  BeanDefinitionBuilder builder = new BeanDefinitionBuilder(new RootBeanDefinition());
  builder.beanDefinition.setBeanClass(beanClass);
  builder.beanDefinition.setFactoryMethodName(factoryMethodName);
  return builder;
}
origin: spring-projects/spring-framework

/**
 * Create a new {@code BeanDefinitionBuilder} used to construct a {@link RootBeanDefinition}.
 * @param beanClassName the class name for the bean that the definition is being created for
 * @param factoryMethodName the name of the method to use to construct the bean instance
 */
public static BeanDefinitionBuilder rootBeanDefinition(String beanClassName, @Nullable String factoryMethodName) {
  BeanDefinitionBuilder builder = new BeanDefinitionBuilder(new RootBeanDefinition());
  builder.beanDefinition.setBeanClassName(beanClassName);
  builder.beanDefinition.setFactoryMethodName(factoryMethodName);
  return builder;
}
origin: spring-projects/spring-framework

/**
 * Create a new {@code BeanDefinitionBuilder} used to construct a {@link GenericBeanDefinition}.
 */
public static BeanDefinitionBuilder genericBeanDefinition() {
  return new BeanDefinitionBuilder(new GenericBeanDefinition());
}
origin: spring-projects/spring-framework

/**
 * Apply the provided default values to this bean.
 * @param defaults the defaults to apply
 */
public void applyDefaults(BeanDefinitionDefaults defaults) {
  setLazyInit(defaults.isLazyInit());
  setAutowireMode(defaults.getAutowireMode());
  setDependencyCheck(defaults.getDependencyCheck());
  setInitMethodName(defaults.getInitMethodName());
  setEnforceInitMethod(false);
  setDestroyMethodName(defaults.getDestroyMethodName());
  setEnforceDestroyMethod(false);
}
origin: spring-projects/spring-framework

  @Override
  public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable {
    ReplaceOverride ro = (ReplaceOverride) getBeanDefinition().getMethodOverrides().getOverride(method);
    Assert.state(ro != null, "ReplaceOverride not found");
    // TODO could cache if a singleton for minor performance optimization
    MethodReplacer mr = this.owner.getBean(ro.getMethodReplacerBeanName(), MethodReplacer.class);
    return mr.reimplement(obj, method, args);
  }
}
origin: spring-projects/spring-framework

@Override
public void validate() throws BeanDefinitionValidationException {
  super.validate();
  if (this.parentName == null) {
    throw new BeanDefinitionValidationException("'parentName' must be set in ChildBeanDefinition");
  }
}
origin: spring-projects/spring-framework

/**
 * Destroy the given bean instance (usually a prototype instance
 * obtained from this factory) according to the given bean definition.
 * @param beanName the name of the bean definition
 * @param bean the bean instance to destroy
 * @param mbd the merged bean definition
 */
protected void destroyBean(String beanName, Object bean, RootBeanDefinition mbd) {
  new DisposableBeanAdapter(bean, beanName, mbd, getBeanPostProcessors(), getAccessControlContext()).destroy();
}
origin: spring-projects/spring-framework

@Override
public void destroyBean(Object existingBean) {
  new DisposableBeanAdapter(existingBean, getBeanPostProcessors(), getAccessControlContext()).destroy();
}
origin: spring-projects/spring-framework

/**
 * Create a new {@code BeanDefinitionBuilder} used to construct a {@link ChildBeanDefinition}.
 * @param parentName the name of the parent bean
 */
public static BeanDefinitionBuilder childBeanDefinition(String parentName) {
  return new BeanDefinitionBuilder(new ChildBeanDefinition(parentName));
}
origin: spring-projects/spring-framework

@Override
public void clearMetadataCache() {
  super.clearMetadataCache();
  clearByTypeCache();
}
origin: spring-projects/spring-framework

@Override
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
  if (!super.isAutowireCandidate(bdHolder, descriptor)) {
    // If explicitly false, do not proceed with any other checks...
    return false;
  }
  return checkGenericTypeMatch(bdHolder, descriptor);
}
origin: spring-projects/spring-framework

@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
  registry.registerBeanDefinition("myTestBean", new RootBeanDefinition(TestBean.class));
}
@Override
origin: spring-projects/spring-framework

@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
  registry.registerBeanDefinition("bfpp1", new RootBeanDefinition(TestBeanFactoryPostProcessor.class));
}
org.springframework.beans.factory.support

Most used classes

  • BeanDefinitionBuilder
    Programmatic means of constructing org.springframework.beans.factory.config.BeanDefinitionusing the
  • BeanDefinitionRegistry
    Interface for registries that hold bean definitions, for example RootBeanDefinition and ChildBeanDef
  • DefaultListableBeanFactory
    Repackaged version from the Spring framework which includes temporal fix for Spring Issue SPR-12970
  • RootBeanDefinition
    Root bean definitions are the most common type of bean definition. They do not derive from a parent
  • AbstractBeanDefinition
    Base class for concrete, full-fledged BeanDefinition classes, factoring out common properties of Gen
  • GenericBeanDefinition,
  • ManagedMap,
  • BeanDefinitionReaderUtils,
  • ManagedSet,
  • AutowireCandidateQualifier,
  • BeanNameGenerator,
  • AbstractBeanFactory,
  • BeanDefinitionValidationException,
  • BeanDefinitionReader,
  • PropertiesBeanDefinitionReader,
  • StaticListableBeanFactory,
  • MethodOverrides,
  • ChildBeanDefinition,
  • DefaultBeanNameGenerator
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now