Java spring上下文和SpringWeb4.2.4.0版本
为什么我需要在新的Java spring上下文和SpringWeb4.2.4.0版本,java,spring,spring-boot,spring-mvc,spring-context,Java,Spring,Spring Boot,Spring Mvc,Spring Context,为什么我需要在新的spring启动项目中包含spring上下文 我的pom.xml中有这个 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> <dependency> <groupId>org.
spring启动项目中包含spring上下文
我的pom.xml中有这个
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
您看到SpringWeb提供的spring上下文了吗?或者它确实依赖于SpringWeb?您可能想帮自己一个忙,使用SpringBootStarter人工制品,它实际上包含所有必需的依赖项,并且不将任何依赖项标记为“已提供”
在您的情况下,它将是SpringBootStarterWeb。您是否看到SpringWeb提供的spring上下文,或者它确实依赖于SpringWeb?您可能想帮自己一个忙,使用SpringBootStarter人工制品,它实际上包含所有必需的依赖项,并且不将任何依赖项标记为“已提供”
在您的情况下,它将是spring boot starter web。当我们查看spring web
的编译依赖项时,spring上下文
不包括在最新版本中
尽管它在以前的版本中存在。
因为我看不到您正在添加到pom.xml文件中的特定版本,所以我假设它是最新版本,其中spring上下文的依赖关系不包含在spring web
中
此外,您提供的错误堆栈跟踪在本质上是非常少和通用的,因此进一步调试您的问题变得困难,尽管我认为这是版本的问题
您可以通过以下方式提供特定版本:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
org.springframework
弹簧网
5.2.6.1发布
当我们查看SpringWeb
的编译依赖项时,SpringContext
不包含在最新版本中
尽管它在以前的版本中存在。
因为我看不到您正在添加到pom.xml文件中的特定版本,所以我假设它是最新版本,其中spring上下文的依赖关系不包含在spring web
中
此外,您提供的错误堆栈跟踪在本质上是非常少和通用的,因此进一步调试您的问题变得困难,尽管我认为这是版本的问题
您可以通过以下方式提供特定版本:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
org.springframework
弹簧网
5.2.6.1发布
您遇到了什么错误?当我运行应用程序时:在上下文初始化过程中遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建名为“nameOfController”的bean时出错?您遇到了什么错误?当我运行应用程序时:在上下文初始化过程中遇到异常上下文初始化-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建名为“nameOfController”的bean时出错