|
33 | 33 | import org.springframework.beans.factory.ObjectProvider; |
34 | 34 | import org.springframework.beans.factory.annotation.Qualifier; |
35 | 35 | import org.springframework.context.ApplicationContext; |
| 36 | +import org.springframework.context.EmbeddedValueResolverAware; |
36 | 37 | import org.springframework.context.annotation.Bean; |
37 | 38 | import org.springframework.context.annotation.Configuration; |
38 | 39 | import org.springframework.context.annotation.Import; |
|
119 | 120 | import org.springframework.http.server.ServerHttpRequest; |
120 | 121 | import org.springframework.plugin.core.PluginRegistry; |
121 | 122 | import org.springframework.util.ClassUtils; |
| 123 | +import org.springframework.util.StringValueResolver; |
122 | 124 | import org.springframework.web.bind.support.ConfigurableWebBindingInitializer; |
123 | 125 | import org.springframework.web.cors.CorsConfiguration; |
124 | 126 | import org.springframework.web.method.support.HandlerMethodArgumentResolver; |
|
155 | 157 | SpringDataJacksonConfiguration.class, // |
156 | 158 | EnableSpringDataWebSupport.QuerydslActivator.class }) |
157 | 159 | public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebConfiguration |
158 | | - implements BeanClassLoaderAware { |
| 160 | + implements BeanClassLoaderAware, EmbeddedValueResolverAware { |
159 | 161 |
|
160 | 162 | private static final boolean IS_JPA_AVAILABLE = ClassUtils.isPresent("javax.persistence.EntityManager", |
161 | 163 | RepositoryRestMvcConfiguration.class.getClassLoader()); |
@@ -196,6 +198,7 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon |
196 | 198 | private final Lazy<HateoasSortHandlerMethodArgumentResolver> sortResolver; |
197 | 199 |
|
198 | 200 | private ClassLoader beanClassLoader; |
| 201 | + private StringValueResolver stringValueResolver; |
199 | 202 |
|
200 | 203 | public RepositoryRestMvcConfiguration( // |
201 | 204 | ApplicationContext context, // |
@@ -286,6 +289,15 @@ public void setBeanClassLoader(ClassLoader classLoader) { |
286 | 289 | this.beanClassLoader = classLoader; |
287 | 290 | } |
288 | 291 |
|
| 292 | + /* |
| 293 | + * (non-Javadoc) |
| 294 | + * @see org.springframework.context.EmbeddedValueResolverAware#setEmbeddedValueResolver(org.springframework.util.StringValueResolver) |
| 295 | + */ |
| 296 | + @Override |
| 297 | + public void setEmbeddedValueResolver(StringValueResolver resolver) { |
| 298 | + this.stringValueResolver = resolver; |
| 299 | + } |
| 300 | + |
289 | 301 | @Bean |
290 | 302 | public Repositories repositories() { |
291 | 303 | return new Repositories(applicationContext); |
@@ -688,12 +700,14 @@ public DelegatingHandlerMapping restHandlerMapping(Repositories repositories, |
688 | 700 | repositoryMapping.setApplicationContext(applicationContext); |
689 | 701 | repositoryMapping.setCorsConfigurations(corsConfigurations); |
690 | 702 | repositoryMapping.setPatternParser(parser); |
| 703 | + repositoryMapping.setEmbeddedValueResolver(stringValueResolver); |
691 | 704 | repositoryMapping.afterPropertiesSet(); |
692 | 705 |
|
693 | 706 | BasePathAwareHandlerMapping basePathMapping = new BasePathAwareHandlerMapping(repositoryRestConfiguration); |
694 | 707 | basePathMapping.setApplicationContext(applicationContext); |
695 | 708 | basePathMapping.setCorsConfigurations(corsConfigurations); |
696 | 709 | basePathMapping.setPatternParser(parser); |
| 710 | + basePathMapping.setEmbeddedValueResolver(stringValueResolver); |
697 | 711 | basePathMapping.afterPropertiesSet(); |
698 | 712 |
|
699 | 713 | List<HandlerMapping> mappings = new ArrayList<>(); |
|
0 commit comments