Example usage for org.springframework.data.rest.webmvc RepositoryRestHandlerMapping afterPropertiesSet

List of usage examples for org.springframework.data.rest.webmvc RepositoryRestHandlerMapping afterPropertiesSet

Introduction

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

Prototype

@Override
    public void afterPropertiesSet() 

Source Link

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  www  .  ja  v a2  s  . 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);
}