13.07.2015 Views

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

please define productname in your docbook file!4.4 <strong>Spring</strong> <strong>Data</strong> extensionsThis section documents a set of <strong>Spring</strong> <strong>Data</strong> extensions that enable <strong>Spring</strong> <strong>Data</strong> usage in a variety ofcontexts. Currently most of the integration is targeted towards <strong>Spring</strong> MVC.<strong>Web</strong> supportNoteThis section contains the documentation for the <strong>Spring</strong> <strong>Data</strong> web support as it is implementedas of <strong>Spring</strong> <strong>Data</strong> Commons in the 1.6 range. As it the newly introduced support changes quitea lot of things we kept the documentation of the former behavior in the section called “Legacyweb support”.Also note that the JavaConfig support introduced in <strong>Spring</strong> <strong>Data</strong> Commons 1.6 requires <strong>Spring</strong>3.2 due to some issues with JavaConfig and overridden methods in <strong>Spring</strong> 3.1.<strong>Spring</strong> <strong>Data</strong> modules ships with a variety of web support if the module supports the repositoryprogramming model. The web related stuff requires <strong>Spring</strong> MVC JARs on the classpath, some of themeven provide integration with <strong>Spring</strong> HATEOAS.3 In general, the integration support is enabled by using the @Enable<strong>Spring</strong><strong>Data</strong><strong>Web</strong>Supportannotation in your JavaConfig configuration class.@Configuration@Enable<strong>Web</strong>Mvc@Enable<strong>Spring</strong><strong>Data</strong><strong>Web</strong>Supportclass <strong>Web</strong>Configuration { }Example 4.18 Enabling <strong>Spring</strong> <strong>Data</strong> web supportThe @Enable<strong>Spring</strong><strong>Data</strong><strong>Web</strong>Support annotation registers a few components we will discuss in a bit.It will also detect <strong>Spring</strong> HATEOAS on the classpath and register integration components for it as wellif present.Alternatively, if you are using XML configuration, register either <strong>Spring</strong><strong>Data</strong><strong>Web</strong>Support orHateoasAware<strong>Spring</strong><strong>Data</strong><strong>Web</strong>Support as <strong>Spring</strong> beans:Example 4.19 Enabling <strong>Spring</strong> <strong>Data</strong> web support in XMLBasic web supportThe configuration setup shown above will register a few basic components:• A DomainClassConverter to enable <strong>Spring</strong> MVC to resolve instances of repository manageddomain classes from request parameters or path variables.• HandlerMethodArgumentResolver implementations to let <strong>Spring</strong> MVC resolve Pageable andSort instances from request parameters.3 <strong>Spring</strong> HATEOAS - https://github.com/<strong>Spring</strong>Source/spring-hateoas1.4.0.BUILD-SNAPSHOT<strong>Spring</strong> <strong>Data</strong> <strong>MongoDB</strong> -Reference Documentation 15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!