java 无法使用 maven 导入 org.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
Can't import org.springframework.jdbc.core with maven
提问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
, SqlParameter
and StoredProcedure
require the spring-jdbcartifact.
SqlInOutParameter
,SqlParameter
并且StoredProcedure
需要spring-jdbc神器。
It does not appear in the dependent artifacts for spring-context
. The artifact for spring-orm
doescontain this dependency however. See here
它不会出现在 的依赖工件中spring-context
。但是,for 的工件spring-orm
确实包含此依赖项。看这里