Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
1ab98ca3
Commit
1ab98ca3
authored
Jul 10, 2018
by
Andy Wilkinson
Committed by
Stephane Nicoll
Jul 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start building against Spring HATEOAS 0.25.0 snapshots
See gh-13742
parent
21160da9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
76 deletions
+6
-76
HypermediaAutoConfiguration.java
...ot/autoconfigure/hateoas/HypermediaAutoConfiguration.java
+1
-55
HypermediaAutoConfigurationTests.java
...toconfigure/hateoas/HypermediaAutoConfigurationTests.java
+4
-20
pom.xml
spring-boot-project/spring-boot-dependencies/pom.xml
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java
View file @
1ab98ca3
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -18,11 +18,6 @@ package org.springframework.boot.autoconfigure.hateoas;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.NoSuchBeanDefinitionException
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
...
...
@@ -33,7 +28,6 @@ import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConf
import
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.hateoas.EntityLinks
;
...
...
@@ -42,7 +36,6 @@ import org.springframework.hateoas.Resource;
import
org.springframework.hateoas.config.EnableEntityLinks
;
import
org.springframework.hateoas.config.EnableHypermediaSupport
;
import
org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType
;
import
org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
;
import
org.springframework.plugin.core.Plugin
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -71,11 +64,6 @@ public class HypermediaAutoConfiguration {
@EnableHypermediaSupport
(
type
=
HypermediaType
.
HAL
)
protected
static
class
HypermediaConfiguration
{
@Bean
public
static
HalObjectMapperConfigurer
halObjectMapperConfigurer
()
{
return
new
HalObjectMapperConfigurer
();
}
}
@Configuration
...
...
@@ -85,46 +73,4 @@ public class HypermediaAutoConfiguration {
}
/**
* {@link BeanPostProcessor} to apply any {@link Jackson2ObjectMapperBuilder}
* configuration to the HAL {@link ObjectMapper}.
*/
private
static
class
HalObjectMapperConfigurer
implements
BeanPostProcessor
,
BeanFactoryAware
{
private
BeanFactory
beanFactory
;
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
bean
instanceof
ObjectMapper
&&
"_halObjectMapper"
.
equals
(
beanName
))
{
postProcessHalObjectMapper
((
ObjectMapper
)
bean
);
}
return
bean
;
}
private
void
postProcessHalObjectMapper
(
ObjectMapper
objectMapper
)
{
try
{
Jackson2ObjectMapperBuilder
builder
=
this
.
beanFactory
.
getBean
(
Jackson2ObjectMapperBuilder
.
class
);
builder
.
configure
(
objectMapper
);
}
catch
(
NoSuchBeanDefinitionException
ex
)
{
// No Jackson configuration required
}
}
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
return
bean
;
}
@Override
public
void
setBeanFactory
(
BeanFactory
beanFactory
)
throws
BeansException
{
this
.
beanFactory
=
beanFactory
;
}
}
}
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfigurationTests.java
View file @
1ab98ca3
...
...
@@ -16,12 +16,12 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
hateoas
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.autoconfigure.ImportAutoConfiguration
;
import
org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration.EntityLinksConfiguration
;
import
org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration.HypermediaConfiguration
;
import
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration
;
...
...
@@ -91,24 +91,8 @@ public class HypermediaAutoConfigurationTests {
TestPropertyValues
.
of
(
"spring.jackson.serialization.INDENT_OUTPUT:true"
)
.
applyTo
(
this
.
context
);
this
.
context
.
refresh
();
ObjectMapper
objectMapper
=
this
.
context
.
getBean
(
"_halObjectMapper"
,
ObjectMapper
.
class
);
assertThat
(
objectMapper
.
getSerializationConfig
()
.
isEnabled
(
SerializationFeature
.
INDENT_OUTPUT
)).
isFalse
();
}
@Test
public
void
jacksonConfigurationIsAppliedToTheHalObjectMapper
()
{
this
.
context
=
new
AnnotationConfigWebApplicationContext
();
this
.
context
.
setServletContext
(
new
MockServletContext
());
this
.
context
.
register
(
BaseConfig
.
class
);
TestPropertyValues
.
of
(
"spring.jackson.serialization.INDENT_OUTPUT:true"
)
.
applyTo
(
this
.
context
);
this
.
context
.
refresh
();
ObjectMapper
objectMapper
=
this
.
context
.
getBean
(
"_halObjectMapper"
,
ObjectMapper
.
class
);
assertThat
(
objectMapper
.
getSerializationConfig
()
.
isEnabled
(
SerializationFeature
.
INDENT_OUTPUT
)).
isTrue
();
assertThat
(
this
.
context
.
getBeansOfType
(
HypermediaConfiguration
.
class
)).
isEmpty
();
assertThat
(
this
.
context
.
getBeansOfType
(
EntityLinksConfiguration
.
class
)).
isEmpty
();
}
@Test
...
...
spring-boot-project/spring-boot-dependencies/pom.xml
View file @
1ab98ca3
...
...
@@ -156,7 +156,7 @@
<spring-batch.version>
4.0.1.RELEASE
</spring-batch.version>
<spring-cloud-connectors.version>
2.0.2.RELEASE
</spring-cloud-connectors.version>
<spring-data-releasetrain.version>
Kay-SR8
</spring-data-releasetrain.version>
<spring-hateoas.version>
0.2
4.0.RELEASE
</spring-hateoas.version>
<spring-hateoas.version>
0.2
5.0.BUILD-SNAPSHOT
</spring-hateoas.version>
<spring-integration.version>
5.0.7.BUILD-SNAPSHOT
</spring-integration.version>
<spring-kafka.version>
2.1.8.BUILD-SNAPSHOT
</spring-kafka.version>
<spring-ldap.version>
2.3.2.RELEASE
</spring-ldap.version>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment