#52 - Introduced UriComponentsContributor SPI.

Introduced UriComponentsContributor interface to allow components to enhance the UriComponentsBuilder used while building links point in to controller methods.

Moved logic from ControllerLinkBuilder into ControllerLinkBuilderFactory as we now potentially need access to Spring injected components. Might be necessary to get rid of the static LinkBuilder implementations entirely.
This commit is contained in:
Oliver Gierke
2013-02-18 19:11:58 +01:00
parent 72837210ee
commit 8039c306e9
5 changed files with 188 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012 the original author or authors.
* Copyright 2012-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,9 +83,12 @@ public class LinkBuilderBeanDefinitionRegistrar implements ImportBeanDefinitionR
private static BeanDefinitionBuilder getEntityControllerLinksFor(Class<? extends Annotation> type,
Class<? extends LinkBuilderFactory<?>> linkBuilderFactoryType) {
RootBeanDefinition definition = new RootBeanDefinition(linkBuilderFactoryType);
definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(ControllerEntityLinksFactoryBean.class);
builder.addPropertyValue("annotation", type);
builder.addPropertyValue("linkBuilderFactory", new RootBeanDefinition(linkBuilderFactoryType));
builder.addPropertyValue("linkBuilderFactory", definition);
return builder;
}