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

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

Introduction

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

Prototype

public void setJpaHelper(JpaHelper jpaHelper) 

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 . j  ava 2 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);
}