LoginSignup
1
1

More than 5 years have passed since last update.

Grails3.xでCommonsMultipartFileを使うには追加で設定が必要

Posted at

Grailsでファイルアップローダーを実装するとき、Spring FrameworkのCommonsMultipartFileが便利そうなので使おうとしたけど、ググッた情報だとハマったので対処方法を書く。

https://www.ntts.co.jp/column/tec/java_02/index2.htmlhttp://qiita.com/saba1024/items/aefa65143ff6087111d0 の情報などだと2.xの時はimport org.springframework.web.multipart.commons.CommonsMultipartFileするだけで使えると書いているけど、これだとビルド時に内部で使われているクラスがないよと怒られた。
エラー内容をググったらcommons-uploadが必要だとわかったのでbuild.gradleのdependenciesに追加する。
2016/08/06時点では1.3.2が最新だったので

compile 'commons-fileupload:commons-fileupload:1.3.2'

と書いてビルドし直すと通った。
多分3.0以降でSpringベースからSpring Bootベースに変わったせいで読み込みライブラリに変更があったのだろう。
とりあえずビルドはできたので今からちゃんと動作しているか試してみる。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1