Tabnine Logo
ConfigurableBeanFactory.addBeanPostProcessor
Code IndexAdd Tabnine to your IDE (free)

How to use
addBeanPostProcessor
method
in
org.springframework.beans.factory.config.ConfigurableBeanFactory

Best Java code snippets using org.springframework.beans.factory.config.ConfigurableBeanFactory.addBeanPostProcessor (Showing top 3 results out of 585)

origin: sakaiproject/sakai

ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) cac.getBeanFactory();
cbf.addBeanPostProcessor(new BeanPostProcessor() {
  @SuppressWarnings("unchecked")
  public Object postProcessBeforeInitialization(Object bean, String beanName) {
origin: brianway/spring-learning

public static void lifeCycleInBeanFactory(String xmlPath, String beanId) {
  //装载配置文件并启动容器
  Resource res = new ClassPathResource(xmlPath);
  BeanFactory bf = new XmlBeanFactory(res);
  //向容器中注册MyBeanPostProcessor后处理器
  ((ConfigurableBeanFactory) bf).addBeanPostProcessor(new MyBeanPostProcessor());
  //向容器中注册MyInstantiationAwareBeanPostProcessor后处理器
  ((ConfigurableBeanFactory) bf).addBeanPostProcessor(new MyInstantiationAwareBeanPostProcessor());
  //第一次从容器中获取car,将触发容器实例化该Bean,这将引发Bean生命周期方法调用
  Car car1 = (Car) bf.getBean(beanId);
  car1.introduce();
  car1.setColor("红色");
  System.out.println("第二次从容器中获取car");
  //第二次从容器中获取car,若为 singleton,直接从缓存池获取
  Car car2 = (Car) bf.getBean(beanId);
  System.out.println("car1==car2:" + (car1 == car2));
  //关闭容器
  ((XmlBeanFactory) bf).destroySingletons();
}
origin: uk.org.ponder.rsf/rsf-core-servletutil

public void afterPropertiesSet() throws Exception {
 ConfigurableApplicationContext cac = (ConfigurableApplicationContext) applicationContext;
 ConfigurableBeanFactory cbf = cac.getBeanFactory();
 final Set guardSet = new HashSet();
 cbf.addBeanPostProcessor(new BeanPostProcessor() {
  public Object postProcessBeforeInitialization(Object bean, String beanName)
    throws BeansException {
   guardSet.add(beanName);
   return bean;
  }
 
  public Object postProcessAfterInitialization(Object bean, String beanName)
    throws BeansException {
   return bean;
  }
 });
 TLABPostProcessor processor = new TLABPostProcessor();
 processor.setApplicationContext(applicationContext);
 processor.checkGuard(guardSet);
 processor.setMappingContext(mappingContext == null? SAXalizerMappingContext.instance() : mappingContext);
  cbf.addBeanPostProcessor(processor);
}
org.springframework.beans.factory.configConfigurableBeanFactoryaddBeanPostProcessor

Javadoc

Add a new BeanPostProcessor that will get applied to beans created by this factory. To be invoked during factory configuration.

Note: Post-processors submitted here will be applied in the order of registration; any ordering semantics expressed through implementing the org.springframework.core.Ordered interface will be ignored. Note that autodetected post-processors (e.g. as beans in an ApplicationContext) will always be applied after programmatically registered ones.

Popular methods of ConfigurableBeanFactory

  • resolveEmbeddedValue
    Resolve the given embedded value, e.g. an annotation attribute.
  • getBeanExpressionResolver
    Return the resolution strategy for expressions in bean definition values.
  • getBean
  • registerSingleton
    Register the given existing object as singleton in the bean factory, under the given bean name.The g
  • getTypeConverter
    Obtain a type converter as used by this BeanFactory. This may be a fresh instance for each call, sin
  • getBeanClassLoader
    Return this factory's class loader for loading bean classes (only null if even the system ClassLoade
  • containsBean
  • getConversionService
    Return the associated ConversionService, if any.
  • getMergedBeanDefinition
    Return a merged BeanDefinition for the given bean name, merging a child bean definition with its par
  • isCurrentlyInCreation
    Determine whether the specified bean is currently in creation.
  • getSingletonMutex
  • destroySingletons
    Destroy all cached singletons in this factory. To be called on shutdown of a factory.
  • getSingletonMutex,
  • destroySingletons,
  • getSingletonNames,
  • registerDependentBean,
  • containsSingleton,
  • destroyBean,
  • isFactoryBean,
  • isSingleton,
  • registerAlias

Popular in Java

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSharedPreferences (Context)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • CodeWhisperer alternatives
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