private < T > T getBeanOrNull ( String name , Class < T > requiredType ) { if ( name == null || ! applicationContext . containsBean ( name ) ) { return null ; } else { try { return applicationContext . getBean ( name , requiredType ) ; } catch ( BeansException be ) { log . error ( "Error during getBeanOrNull, not rethrown, " + be . getMessage ( ) , be ) ; return null ; } } }
Get a bean from the application context . Returns null if the bean does not exist .