java 无法使用 maven 导入 o​​rg.springframework.jdbc.core

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15029292/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 18:16:49  来源:igfitidea点击:

Can't import org.springframework.jdbc.core with maven

javaspringmavenjdbc

提问by SJS

I dont know why the follow imports are not getting found in my project: Code:

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

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

I have the folllowing in my pom.xml file

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

Code:

代码:

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

But I have found that if I add the following it works but I dont see why I need to:

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

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

回答by Gerard Ribas

If you want to work with Spring Jdbc packages you have to import the correct library:

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

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

回答by Reimeus

SqlInOutParameter, SqlParameterand StoredProcedurerequire the spring-jdbcartifact.

SqlInOutParameterSqlParameter并且StoredProcedure需要spring-jdbc神器。

It does not appear in the dependent artifacts for spring-context. The artifact for spring-ormdoescontain this dependency however. See here

它不会出现在 的依赖工件中spring-context。但是,for 的工件spring-orm确实包含此依赖项。看这里