質問編集履歴

2

エラーログを追記

2021/07/14 00:22

投稿

sakura2685
sakura2685

スコア20

test CHANGED
File without changes
test CHANGED
@@ -94,8 +94,32 @@
94
94
 
95
95
  ```error
96
96
 
97
+ ***************************
98
+
99
+ APPLICATION FAILED TO START
100
+
101
+ ***************************
102
+
103
+
104
+
105
+ Description:
106
+
107
+
108
+
97
109
  The bean 'accountService', defined in class path resource [net/dkt/dktsearch/service/AccountServiceTest$Config.class], could not be registered. A bean with that name has already been defined in file [C:\Users\nao\Documents\workspace-spring-tool-suite-4-4.6.2.RELEASE\dktsearch\target\classes\net\dkt\dktsearch\service\AccountService.class] and overriding is disabled.
98
110
 
111
+
112
+
113
+ Action:
114
+
115
+
116
+
117
+ Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
118
+
119
+
120
+
121
+ 2021-07-14 09:17:12.098 ERROR 11788 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@34f5090e] to prepare test instance [net.dkt.dktsearch.controller.HomeControllerTest@5eefa415]
122
+
99
123
  ```
100
124
 
101
125
 

1

環境を追記

2021/07/14 00:22

投稿

sakura2685
sakura2685

スコア20

test CHANGED
File without changes
test CHANGED
@@ -211,3 +211,11 @@
211
211
 
212
212
 
213
213
  @TestConfigurationを使用した場合はコンポーネントスキャン対象から外されるはずなのになぜBean重複エラーとなってしまうのでしょうか?
214
+
215
+
216
+
217
+ 環境
218
+
219
+ Apache Maven 3.6.3
220
+
221
+ Java version: 1.8.0_241