我剛開始學習Spring,並且有從Spring導入類的問題,請大家幫忙!我想幾乎所有的東西我發現一個解決方案,但它是一個失敗...無法導入org.springframework.context.ApplicationContext?
Error:
The import org.springframework.context.ApplicationContext cannot be resolved.
這裏是我的代碼
import org.springframework.context.*; //I can import this
import org.springframework.context.ApplicationContext; //But I can't import this
或
import org.springframework.stereotype.*; //I can import this
import org.springframework.stereotype.Controller; //But I can't import this
這是我的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<packaging>jar</packaging>
<groupId>helloworld</groupId>
<artifactId>hello-world</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
</dependencies>
</project>
把一些代碼會有幫助 – Jaiwo99
我可以放什麼代碼?我認爲這對我的問題已經足夠了。我無法從Spring框架庫導入類。這是我的整個pom.xml,我不認爲我的主要類的主體必須對錯誤做些什麼,因爲它是空的... – dzoniBravo