Example usage for org.springframework.web.context ConfigurableWebApplicationContext getBeansOfType

List of usage examples for org.springframework.web.context ConfigurableWebApplicationContext getBeansOfType

Introduction

In this page you can find the example usage for org.springframework.web.context ConfigurableWebApplicationContext getBeansOfType.

Prototype

<T> Map<String, T> getBeansOfType(@Nullable Class<T> type) throws BeansException;

Source Link

Document

Return the bean instances that match the given object type (including subclasses), judging from either bean definitions or the value of getObjectType in the case of FactoryBeans.

Usage

From source file:com.kixeye.chassis.transport.http.HttpTransportConfiguration.java

private Collection<ObjectMapper> getObjectMappers(ConfigurableWebApplicationContext webApplicationContext) {
    Map<String, JacksonMessageSerDe> serdes = webApplicationContext.getBeansOfType(JacksonMessageSerDe.class);
    if (serdes.isEmpty()) {
        return Collections.emptyList();
    }/*www . j  av  a  2s.com*/
    return Collections2.transform(serdes.values(), new Function<JacksonMessageSerDe, ObjectMapper>() {
        @Nullable
        @Override
        public ObjectMapper apply(@Nullable JacksonMessageSerDe serDe) {
            return serDe.getObjectMapper();
        }
    });
}