@GetMapping没有被导入

huangapple go评论150阅读模式
英文:

@GetMapping is not getting imported

问题

用于澄清的图片
我对Spring MVC还很陌生,我正在使用Maven进行这个项目。我尝试导入@GetMapping,但它没有被导入。可能是什么问题?有人可以帮帮我吗?

<!-- Spring依赖 -->
<!-- Spring IOC -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>5.2.3.RELEASE</version>
</dependency>

<!-- Spring容器 -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>5.2.3.RELEASE</version>
</dependency>

<!-- Spring JDBC -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>5.2.3.RELEASE</version>
</dependency>

<!-- Spring MVC -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>5.2.3.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>5.2.3.RELEASE</version>
</dependency>
英文:

Image for clarification
I am new to Spring MVC and I am doing this project on maven. I was trying to import @GetMapping but it did not get imported. What could be the issue? Could someone please help me?

&lt;!-- Spring dependencies --!&gt;
		&lt;!-- Spring IOC --&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework&lt;/groupId&gt;
			&lt;artifactId&gt;spring-core&lt;/artifactId&gt;
			&lt;version&gt;5.2.3.RELEASE&lt;/version&gt;
		&lt;/dependency&gt;
		
		&lt;!-- Spring container --&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework&lt;/groupId&gt;
			&lt;artifactId&gt;spring-context&lt;/artifactId&gt;
			&lt;version&gt;5.2.3.RELEASE&lt;/version&gt;
		&lt;/dependency&gt;

		&lt;!-- Spring JDBC --&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework&lt;/groupId&gt;
			&lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
			&lt;version&gt;5.2.3.RELEASE&lt;/version&gt;
		&lt;/dependency&gt;


		&lt;!-- Spring MVC --&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework&lt;/groupId&gt;
			&lt;artifactId&gt;spring-web&lt;/artifactId&gt;
			&lt;version&gt;5.2.3.RELEASE&lt;/version&gt;
		&lt;/dependency&gt;

		&lt;dependency&gt;
			&lt;groupId&gt;org.springframework&lt;/groupId&gt;
			&lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
			&lt;version&gt;5.2.3.RELEASE&lt;/version&gt;
		&lt;/dependency&gt;

答案1

得分: 1

你需要描述import org.springframework.web.bind.annotation.GetMapping;像这样

Eclipse的快速修复功能非常有用。

英文:

You need to describe import org.springframework.web.bind.annotation.GetMapping;, like this.

Eclipse quick fix function is useful.

huangapple
  • 本文由 发表于 2020年5月30日 10:22:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/62097048.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定