Skip to content

Commit 81ec7ae

Browse files
committed
Fix clashing bean name with JsonTest and Jacksons 2 and 3
Fixes gh-48198
1 parent 21b27df commit 81ec7ae

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

module/spring-boot-jackson2/src/main/java/org/springframework/boot/jackson2/autoconfigure/Jackson2TesterTestAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ final class Jackson2TesterTestAutoConfiguration {
4848
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
4949
@ConditionalOnBean(ObjectMapper.class)
5050
@ImportRuntimeHints(Jackson2TesterRuntimeHints.class)
51-
FactoryBean<Jackson2Tester<?>> jacksonTesterFactoryBean(ObjectMapper mapper) {
51+
FactoryBean<Jackson2Tester<?>> jackson2TesterFactoryBean(ObjectMapper mapper) {
5252
return new JsonTesterFactoryBean<>(Jackson2Tester.class, mapper);
5353
}
5454

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2012-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package smoketest.jackson2.mixed;
18+
19+
import org.junit.jupiter.api.Test;
20+
21+
import org.springframework.beans.factory.annotation.Autowired;
22+
import org.springframework.boot.test.autoconfigure.json.JsonTest;
23+
import org.springframework.boot.test.json.JacksonTester;
24+
25+
import static org.assertj.core.api.Assertions.assertThat;
26+
27+
/**
28+
* {@link JsonTest JSON Tests} for {@link SampleJackson2MixedApplication}.
29+
*
30+
* @author Andy Wilkinson
31+
*/
32+
@JsonTest
33+
class SampleJackson2MixedApplicationJsonTests {
34+
35+
@Autowired
36+
@SuppressWarnings({ "deprecation", "removal" })
37+
org.springframework.boot.test.json.Jackson2Tester<Pojo> jackson2Tester;
38+
39+
@Autowired
40+
JacksonTester<Pojo> jacksonTester;
41+
42+
@Test
43+
void jackson2TesterIsInitialized() {
44+
assertThat(this.jackson2Tester).isNotNull();
45+
}
46+
47+
@Test
48+
void jacksonTesterIsInitialized() {
49+
assertThat(this.jacksonTester).isNotNull();
50+
}
51+
52+
static class Pojo {
53+
54+
}
55+
56+
}

0 commit comments

Comments
 (0)