File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/web Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change 21
21
import org .springframework .boot .autoconfigure .AutoConfigurations ;
22
22
import org .springframework .boot .test .context .runner .ApplicationContextRunner ;
23
23
import org .springframework .boot .test .context .runner .WebApplicationContextRunner ;
24
- import org .springframework .context .annotation .Bean ;
25
- import org .springframework .context .annotation .Configuration ;
26
24
import org .springframework .data .domain .PageRequest ;
27
25
import org .springframework .data .web .PageableHandlerMethodArgumentResolver ;
28
26
import org .springframework .data .web .SortHandlerMethodArgumentResolver ;
@@ -121,22 +119,14 @@ void customizePageSerializationModeViaConfigProps() {
121
119
122
120
@ Test
123
121
void customizePageSerializationModeViaCustomBean () {
124
- this .contextRunner .withUserConfiguration (AppConfiguration .class )
125
- .withPropertyValues ("spring.data.web.pageable.serialization-mode=VIA_DTO" )
122
+ this .contextRunner
123
+ .withBean ("customSpringDataWebSettings" , SpringDataWebSettings .class ,
124
+ () -> new SpringDataWebSettings (PageSerializationMode .VIA_DTO ))
126
125
.run ((context ) -> {
126
+ assertThat (context ).doesNotHaveBean ("springDataWebSettings" );
127
127
SpringDataWebSettings springDataWebSettings = context .getBean (SpringDataWebSettings .class );
128
- assertThat (springDataWebSettings .pageSerializationMode ()).isEqualTo (PageSerializationMode .DIRECT );
128
+ assertThat (springDataWebSettings .pageSerializationMode ()).isEqualTo (PageSerializationMode .VIA_DTO );
129
129
});
130
130
}
131
131
132
- @ Configuration
133
- static class AppConfiguration {
134
-
135
- @ Bean
136
- SpringDataWebSettings springDataWebSettings () {
137
- return new SpringDataWebSettings (PageSerializationMode .DIRECT );
138
- }
139
-
140
- }
141
-
142
132
}
You can’t perform that action at this time.
0 commit comments