質問編集履歴

1

解決したため、その手順の覚書

2016/04/11 05:15

投稿

poyopi
poyopi

スコア113

test CHANGED
File without changes
test CHANGED
@@ -161,3 +161,77 @@
161
161
 
162
162
 
163
163
  必要な情報等あれば随時補足追記致します。よろしくお願い致します。
164
+
165
+
166
+
167
+ ---
168
+
169
+
170
+
171
+ [tkturbo](https://teratail.com/users/tkturbo)さんより頂いたご助言から、エラーの中の```Caused by: java.lang.NoSuchMethodError: org.springframework.beans.BeanUtils.instantiateClass(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object;```でサーチしました。これまでbuild.gradleを下記のようにしていたので
172
+
173
+ ```gradle
174
+
175
+ dependencies {
176
+
177
+ //spring関連のみ抜粋
178
+
179
+ compile 'org.springframework:spring:2.5.6.SEC03'
180
+
181
+ compile 'org.springframework:spring-context:4.2.5.RELEASE'
182
+
183
+ compile 'org.springframework:spring-core:4.2.5.RELEASE'
184
+
185
+
186
+
187
+ testCompile 'org.springframework:spring-test:4.2.5.RELEASE'
188
+
189
+ }
190
+
191
+ ```
192
+
193
+ 下記のように改めました
194
+
195
+ ```gradle
196
+
197
+ ext {
198
+
199
+ springVersion='4.0.5.RELEASE'
200
+
201
+ }
202
+
203
+
204
+
205
+ dependencies {
206
+
207
+ compile 'org.springframework:spring:2.5.6.SEC03'
208
+
209
+ compile "org.springframework:spring-context:$springVersion"
210
+
211
+ compile "org.springframework:spring-core:$springVersion"
212
+
213
+ testCompile "org.springframework:spring-test:$springVersion"
214
+
215
+ }
216
+
217
+ ```
218
+
219
+ すると先ほどまでのエラーの部分の文言が少し変わり、```Caused by: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.getAnnotationAttributes(Ljava/lang/annotation/Annotation;ZZ)Lorg/springframework/core/annotation/AnnotationAttributes;```これをみると
220
+
221
+
222
+
223
+ ```gradle
224
+
225
+ compile 'org.springframework:spring:2.5.6.SEC03'
226
+
227
+ ```
228
+
229
+ これが悪い気がしたので取り除きました。
230
+
231
+ 例外を出さず動くようになりました。
232
+
233
+ 参考:[java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)Z - Stack Overflow](http://stackoverflow.com/questions/23789271/java-lang-nosuchmethoderror-org-springframework-core-annotation-annotationutils)
234
+
235
+
236
+
237
+ 悪い気がしたのでという書き方の通り、各アーティファクトが何の役割のものか理解がないので、[ドキュメンテーション](http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#overview-modules)を見て少しずつわかるようにしたいと思います。