Example usage for org.springframework.data.rest.webmvc.support DelegatingHandlerMapping DelegatingHandlerMapping

List of usage examples for org.springframework.data.rest.webmvc.support DelegatingHandlerMapping DelegatingHandlerMapping

Introduction

In this page you can find the example usage for org.springframework.data.rest.webmvc.support DelegatingHandlerMapping DelegatingHandlerMapping.

Prototype

public DelegatingHandlerMapping(List<HandlerMapping> delegates) 

Source Link

Document

Creates a new DelegatingHandlerMapping for the given delegates.

Usage

From source file:org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration.java

/**
 * The {@link HandlerMapping} to delegate requests to Spring Data REST controllers. Sets up a
 * {@link DelegatingHandlerMapping} to make sure manually implemented {@link BasePathAwareController} instances that
 * register custom handlers for certain media types don't cause the {@link RepositoryRestHandlerMapping} to be
 * omitted./*from   w  w  w .  j av a 2s  .c  o  m*/
 * 
 * @see DATAREST-490
 * @return
 */
@Bean
public DelegatingHandlerMapping restHandlerMapping() {

    RepositoryRestHandlerMapping repositoryMapping = new RepositoryRestHandlerMapping(resourceMappings(),
            config());
    repositoryMapping.setJpaHelper(jpaHelper());
    repositoryMapping.setApplicationContext(applicationContext);
    repositoryMapping.afterPropertiesSet();

    BasePathAwareHandlerMapping basePathMapping = new BasePathAwareHandlerMapping(config());
    basePathMapping.setApplicationContext(applicationContext);
    basePathMapping.afterPropertiesSet();

    List<HandlerMapping> mappings = new ArrayList<HandlerMapping>();
    mappings.add(basePathMapping);
    mappings.add(repositoryMapping);

    return new DelegatingHandlerMapping(mappings);
}