简体   繁体   English

如何正确知道在Spring上使用CrudRepository的软件包和版本

[英]How to know correctly package and version to use CrudRepository on spring

I am new with spring mvc (version 3.2.2.RELEASE), trying to build a project sample. 我是spring mvc(3.2.2.RELEASE版本)的新手,试图构建项目示例。 I had a controller, working, reading data and parsing a json. 我有一个控制器,可以工作,读取数据并解析json。

So I started to try to access and create data, and found about CrudRepository in a tutorial ( https://spring.io/guides/gs/accessing-data-jpa/ ) that uses "spring-boot-starter-data-jpa" 因此,我开始尝试访问和创建数据,并在使用“ spring-boot-starter-data-jpa”的教程( https://spring.io/guides/gs/accessing-data-jpa/ )中找到了有关CrudRepository的信息。 “

My question is, how do I know which package contains CrudRepository and the version that I should use with my spring version? 我的问题是,我如何知道哪个软件包包含CrudRepository以及应该与我的Spring版本一起使用的版本? As far as I know "spring-boot-starter-data-jpa" is a group of jar, and I have a project that have spring already, so I would need just the CrudRepository artifact 据我所知,“ spring-boot-starter-data-jpa”是一组jar,并且我有一个已经有spring的项目,所以我只需要CrudRepository工件

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


    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>1.9.2.RELEASE</version>
    </dependency>

CrudRepository is part of Spring Data module. CrudRepository是Spring Data模块的一部分。

So this dependency: 因此,这种依赖性:

spring-data-commons

Here is a useful site to find the containing jar of almost any java class: GREPCODE.com: 这是一个有用的站点,可以找到几乎所有Java类的包含jar的容器:GREPCODE.com:

http://grepcode.com/file/repo1.maven.org/maven2/org.springframework.data/spring-data-commons-core/1.1.0.RELEASE/org/springframework/data/repository/CrudRepository.java http://grepcode.com/file/repo1.maven.org/maven2/org.springframework.data/spring-data-commons-core/1.1.0.RELEASE/org/springframework/data/repository/CrudRepository.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM