spring 如何找到包含 org.springframework.stereotype.Service 的库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25206487/
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-09-07 23:57:36  来源:igfitidea点击:

How do I find the library containing org.springframework.stereotype.Service?

springmaven

提问by abc32112

Trying to import import org.springframework.stereotype.Service;I get cannot resolve symbol stereotype. As I understand it, I should be able to get the required dependency using Maven.

尝试导入import org.springframework.stereotype.Service;无法解析符号构造型。据我了解,我应该能够使用 Maven 获得所需的依赖项。

However... how do I find out which dependency to get -- i.e. the name of the dependency? That is, which library contains this library and how would I go about finding out?

但是……我如何找出要获取的依赖项——即依赖项的名称?也就是说,哪个库包含这个库,我将如何查找?

Thanks!

谢谢!

回答by dectarin

It's the spring-context jar that your need. Add the following to your maven dependencies..

这是您需要的 spring-context jar。将以下内容添加到您的 Maven 依赖项中..

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

This example is referencing the latest version of the jar available at the moment but you should match the version with the version of spring that you want.

此示例引用当前可用的最新版本的 jar,但您应该将该版本与所需的 spring 版本相匹配。

回答by Micka?l P

You can use this site : http://www.findjar.com/

你可以使用这个网站:http: //www.findjar.com/

Just past your class name (entire path org.spri...)

刚刚过去你的班级名称(整个路径 org.spri ...)

回答by AlexGreg

Google search

谷歌搜索

org.springframework.stereotype.Service jar

org.springframework.stereotype.Service jar

and then do a search herefor the maven dependency configuration

然后在这里搜索maven依赖配置

回答by ZenLulz

You need to import this dependency in Maven:

您需要在 Maven 中导入此依赖项:

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

Note that the version number can be omitted if you use the parent module of Spring Boot:

注意如果使用Spring Boot的父模块,版本号可以省略:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.3.RELEASE</version>
</parent>

where 1.4.3.RELEASEis the latest version of Spring Boot.

其中1.4.3.RELEASE是 Spring Boot 的最新版本。

回答by Sandeep Havaragi

Make sure you create DynamicWebProject, if you are using a Java Project and added that Maven dependency it would not work. Anyway, you dont need a separate dependency, its part of the spring-context already

确保您创建了 DynamicWebProject,如果您使用的是 Java 项目并添加了该 Maven 依赖项,它将不起作用。无论如何,您不需要单独的依赖项,它已经是 spring-context 的一部分

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