O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

First pitfall

When you call the ListableBeanFactory.getBeansOfType() method, you cannot be sure which beans will be returned. Let's look at the code of the getBeansOfType() method in the DefaultListableBeanFactory.java class:

@Override@SuppressWarnings("unchecked")public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)      throws BeansException {        ......          if (exBeanName != null && isCurrentlyInCreation(exBeanName)) {        if (this.logger.isDebugEnabled()) {          this.logger.debug("Ignoring match to currently created bean           '" +           exBeanName + "': " +          ex.getMessage());        }        onSuppressedException(ex);        // Ignore: indicates a circular reference when auto wiring         constructors. // We want to find matches ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required