【问题标题】:Can't import org.springframework.jdbc.core with maven无法使用 maven 导入 o​​rg.springframework.jdbc.core
【发布时间】:2013-02-22 16:55:42
【问题描述】:

我不知道为什么在我的项目中找不到以下导入: 代码:

import org.springframework.jdbc.core.SqlInOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.StoredProcedure;

我的 pom.xml 文件中有以下内容

代码:

<dependency>
 <groupId>org.springframework</groupId>
 <artifactId>spring-context</artifactId>
 <version>3.2.1.RELEASE</version>
</dependency>

但我发现,如果我添加以下内容,它会起作用,但我不明白为什么需要:

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

【问题讨论】:

标签: java spring maven jdbc


【解决方案1】:

如果你想使用 Spring Jdbc 包,你必须导入正确的库:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>3.2.1.RELEASE</version>
</dependency>

【讨论】:

    【解决方案2】:

    SqlInOutParameter、SqlParameter 和 StoredProcedure 需要 spring-jdbc 工件。

    它没有出现在dependent artifacts for spring-context 中。但是,spring-orm 确实 的工件包含此依赖项。见here

    【讨论】:

      猜你喜欢
      • 2019-07-19
      • 2013-10-24
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 2020-07-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多