为什么没有自动导入类org / apache / commons / fileupload / FileItemFactory

时间:2017-10-25 07:28:17

标签: spring maven spring-mvc spring-web apache-commons-fileupload

我在pom.xml中有基本依赖

<dependencies>

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjweaver</artifactId>
  <version>1.7.3</version>
</dependency>
<dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjrt</artifactId>
  <version>1.6.11</version>
</dependency>

<dependency>
  <groupId>org.codehaus.jackson</groupId>
  <artifactId>jackson-mapper-asl</artifactId>
  <version>1.9.12</version>
</dependency>

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-jdbc</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!-- mybatis -->
<dependency>
  <groupId>org.mybatis</groupId>
  <artifactId>mybatis-spring</artifactId>
  <version>${org.mybatis.spring.version}</version>
</dependency>
<dependency>
  <groupId>org.mybatis</groupId>
  <artifactId>mybatis</artifactId>
  <version>${org.mybatis.version}</version>
</dependency>

<!-- data source -->
<dependency>
  <groupId>commons-dbcp</groupId>
  <artifactId>commons-dbcp</artifactId>
  <version>1.4</version>
  <!--<scope>runtime</scope>-->
</dependency>
<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>5.1.6</version>
</dependency>

<!-- log -->
<dependency>
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-classic</artifactId>
  <version>1.1.2</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-core</artifactId>
  <version>1.1.2</version>
  <scope>compile</scope>
</dependency>

<!-- spring test -->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-test</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
  <!--<scope>test</scope>-->
</dependency>

<!-- mybatis pager -->
<dependency>
  <groupId>com.github.pagehelper</groupId>
  <artifactId>pagehelper</artifactId>
  <version>4.1.0</version>
</dependency>
<dependency>
  <groupId>com.github.miemiedev</groupId>
  <artifactId>mybatis-paginator</artifactId>
  <version>1.2.17</version>
</dependency>
<dependency>
  <groupId>com.github.jsqlparser</groupId>
  <artifactId>jsqlparser</artifactId>
  <version>0.9.4</version>
</dependency>

有一个类org.springframework.web.multipart.commons.CommonsMultipartResolver属于spring-web.jar,这个类也依赖于类org.apache.commons.fileupload.FileItemFactory;所以如果我导入了spring-web.jar,那么应该自动导入类org.apache.commons.fileupload.FileItemFactory所属的lib commons-fileupload。

但是现在,当我在mvc xml配置文件中追加以下代码时,我收到类org / apache / commons / fileupload / FileItemFactory的错误:

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <property name="maxUploadSize" value="10485760" />
    <property name="maxInMemorySize" value="4096" />
    <property name="defaultEncoding" value="UTF-8" />
</bean>

我想知道maven为什么不导入lib commons-fileupload

0 个答案:

没有答案