Codota Logo
ConfigurableBeanFactory.getBean
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using org.springframework.beans.factory.config.ConfigurableBeanFactory.getBean (Showing top 20 results out of 1,611)

  • Common ways to obtain ConfigurableBeanFactory
private void myMethod () {
ConfigurableBeanFactory c =
  • Codota IconConfigurableApplicationContext configurableApplicationContext;configurableApplicationContext.getBeanFactory()
  • Codota IconDefaultMessageHandlerMethodFactory defaultMessageHandlerMethodFactory;(ConfigurableBeanFactory) defaultMessageHandlerMethodFactory.beanFactory
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

@Override
public Object getTargetObject() {
  return this.beanFactory.getBean(this.targetBeanName);
}
origin: spring-projects/spring-framework

private Object createInterfaceProxyForFactoryBean(final Object factoryBean, Class<?> interfaceType,
    final ConfigurableBeanFactory beanFactory, final String beanName) {
  return Proxy.newProxyInstance(
      factoryBean.getClass().getClassLoader(), new Class<?>[] {interfaceType},
      (proxy, method, args) -> {
        if (method.getName().equals("getObject") && args == null) {
          return beanFactory.getBean(beanName);
        }
        return ReflectionUtils.invokeMethod(method, factoryBean, args);
      });
}
origin: org.springframework/spring-context

private Object createInterfaceProxyForFactoryBean(final Object factoryBean, Class<?> interfaceType,
    final ConfigurableBeanFactory beanFactory, final String beanName) {
  return Proxy.newProxyInstance(
      factoryBean.getClass().getClassLoader(), new Class<?>[] {interfaceType},
      (proxy, method, args) -> {
        if (method.getName().equals("getObject") && args == null) {
          return beanFactory.getBean(beanName);
        }
        return ReflectionUtils.invokeMethod(method, factoryBean, args);
      });
}
origin: spring-projects/spring-framework

@Nullable
public Object getObject(String key) {
  if (this.beanFactory.containsBean(key)) {
    return this.beanFactory.getBean(key);
  }
  else if (this.scope != null) {
    return this.scope.resolveContextualObject(key);
  }
  else {
    return null;
  }
}
origin: org.springframework/spring-beans

@Nullable
public Object getObject(String key) {
  if (this.beanFactory.containsBean(key)) {
    return this.beanFactory.getBean(key);
  }
  else if (this.scope != null) {
    return this.scope.resolveContextualObject(key);
  }
  else {
    return null;
  }
}
origin: spring-projects/spring-framework

Object beanInstance = (useArgs ? beanFactory.getBean(beanName, beanMethodArgs) :
    beanFactory.getBean(beanName));
if (!ClassUtils.isAssignableValue(beanMethod.getReturnType(), beanInstance)) {
origin: spring-projects/spring-framework

Object factoryBean = beanFactory.getBean(BeanFactory.FACTORY_BEAN_PREFIX + beanName);
if (factoryBean instanceof ScopedProxyFactoryBean) {
origin: org.springframework/spring-context

Object beanInstance = (useArgs ? beanFactory.getBean(beanName, beanMethodArgs) :
    beanFactory.getBean(beanName));
if (!ClassUtils.isAssignableValue(beanMethod.getReturnType(), beanInstance)) {
origin: Red5/red5-server

parentContext = (ApplicationContext) factory.getBean("red5.common");
origin: spring-projects/spring-framework

return beanFactory.getBean(beanName);
origin: org.springframework/spring-context

Object factoryBean = beanFactory.getBean(BeanFactory.FACTORY_BEAN_PREFIX + beanName);
if (factoryBean instanceof ScopedProxyFactoryBean) {
origin: org.springframework/spring-context

return beanFactory.getBean(beanName);
origin: spring-io/initializr

@Override
public void beforeTestClass(TestContext testContext) throws Exception {
  ConfigurableBeanFactory beanFactory = (ConfigurableBeanFactory) testContext
      .getApplicationContext().getAutowireCapableBeanFactory();
  if (!beanFactory.containsBean("mockMvcClientHttpRequestFactory")) {
    this.factory = new MockMvcClientHttpRequestFactory(
        beanFactory.getBean(MockMvc.class));
    beanFactory.registerSingleton("mockMvcClientHttpRequestFactory",
        this.factory);
  }
  else {
    this.factory = beanFactory.getBean("mockMvcClientHttpRequestFactory",
        MockMvcClientHttpRequestFactory.class);
  }
}
origin: spring-projects/spring-framework

@Test
public void aliasing() {
  BeanFactory bf = getBeanFactory();
  if (!(bf instanceof ConfigurableBeanFactory)) {
    return;
  }
  ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) bf;
  String alias = "rods alias";
  try {
    cbf.getBean(alias);
    fail("Shouldn't permit factory get on normal bean");
  }
  catch (NoSuchBeanDefinitionException ex) {
    // Ok
    assertTrue(alias.equals(ex.getBeanName()));
  }
  // Create alias
  cbf.registerAlias("rod", alias);
  Object rod = getBeanFactory().getBean("rod");
  Object aliasRod = getBeanFactory().getBean(alias);
  assertTrue(rod == aliasRod);
}
origin: Red5/red5-server

public void registerSubContext(String webAppKey) {
  // get the sub contexts - servlet context
  ServletContext ctx = servletContext.getContext(webAppKey);
  if (ctx == null) {
    ctx = servletContext;
  }
  ContextLoader loader = new ContextLoader();
  ConfigurableWebApplicationContext appCtx = (ConfigurableWebApplicationContext) loader.initWebApplicationContext(ctx);
  appCtx.setParent(applicationContext);
  appCtx.refresh();
  ctx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appCtx);
  ConfigurableBeanFactory appFactory = appCtx.getBeanFactory();
  logger.debug("About to grab Webcontext bean for {}", webAppKey);
  Context webContext = (Context) appCtx.getBean("web.context");
  webContext.setCoreBeanFactory(parentFactory);
  webContext.setClientRegistry(clientRegistry);
  webContext.setServiceInvoker(globalInvoker);
  webContext.setScopeResolver(globalResolver);
  webContext.setMappingStrategy(globalStrategy);
  WebScope scope = (WebScope) appFactory.getBean("web.scope");
  scope.setServer(server);
  scope.setParent(global);
  scope.register();
  scope.start();
  // register the context so we dont try to reinitialize it
  registeredContexts.add(ctx);
}
origin: camunda/camunda-bpm-platform

public Object getObject(String key) {
  if (this.beanFactory.containsBean(key)) {
    return this.beanFactory.getBean(key);
  }
  else if (this.scope != null){
    return this.scope.resolveContextualObject(key);
  }
  else {
    return null;
  }
}
origin: FastBootWeixin/FastBootWeixin

/**
 * @param beanFactory a bean factory used for resolving  ${...} placeholder
 *                    and #{...} SpEL expressions in default values, or {@code null} if default
 *                    values are not expected to contain expressions
 */
public WxArgumentResolver(ConfigurableBeanFactory beanFactory) {
  super(beanFactory);
  this.wxUserManager = beanFactory.getBean(WxUserManager.class);
  this.wxUserProvider = beanFactory.getBean(WxUserProvider.class);
}
origin: katharsis-project/katharsis-framework

@Override
public <T> T getInstance(Class<T> clazz) {
  // Simply retrieve a bean by the repository class type.
  return beanFactory.getBean(clazz);
}
origin: apache/servicemix-bundles

private Object createInterfaceProxyForFactoryBean(final Object factoryBean, Class<?> interfaceType,
    final ConfigurableBeanFactory beanFactory, final String beanName) {
  return Proxy.newProxyInstance(
      factoryBean.getClass().getClassLoader(), new Class<?>[] {interfaceType},
      (proxy, method, args) -> {
        if (method.getName().equals("getObject") && args == null) {
          return beanFactory.getBean(beanName);
        }
        return ReflectionUtils.invokeMethod(method, factoryBean, args);
      });
}
origin: com.foreach.across/across-core

public AcrossModule getCurrentModule() {
  try {
    return getBeanFactory().getBean( AcrossModule.class );
  }
  catch ( NoSuchBeanDefinitionException nsbe ) {
    return null;
  }
}
org.springframework.beans.factory.configConfigurableBeanFactorygetBean

Javadoc

Return this factory's class loader for loading bean classes.

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.
  • 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.
  • getSingletonNames
  • destroySingletons,
  • getSingletonNames,
  • registerDependentBean,
  • containsSingleton,
  • destroyBean,
  • isFactoryBean,
  • isSingleton,
  • registerAlias,
  • addBeanPostProcessor

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now