Java Spring 错误 : It is not working even i đid exactly everything the teacher said

标签 java spring frameworks java-platform-module-system

package springdemo4;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HelloSpringApp {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Coach theCoach = context.getBean("myCoach",Coach.class);
        System.out.println(theCoach.getDailyFortune());
        System.out.println(theCoach.getDailyWorkout());
        context.close();

    }

}

我运行它,然后它说:

Error occurred during initialization of boot layer java.lang.module.FindException: Unable to derive module descriptor for C:\Users\ngoch\eclipse-workspace\springdemo4\libs\spring-context-indexer-5.1.9.RELEASE-sources.jar Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.springframework.context.index.processor.CandidateComponentsIndexer not in module



请帮忙

最佳答案

我在 Eclipse IDE 上遇到了同样的问题。我错误地在Modulepath下添加了spring jar文件。它应该在 Classpath 下(Properties > Java Build Path > Classpath > addJARs)。

关于Java Spring 错误 : It is not working even i đid exactly everything the teacher said,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57734071/

相关文章:

java - SAAJ 与 JAXB 的兼容性

java - 我想知道如何从另一个应用程序获取使用 Spring Security 保护的 Web 服务 RES 的内容

c# - Entity Framework - 一般持久化枚举?

javascript - 您知道开源 Javascript 提取/正则表达式引擎吗?

java - java中的日期格式问题

java - 为什么 parseFrom() 函数在 java 套接字中使用 protobuf 挂起?

java - JOptionPane.showOptionDialog 不显示按钮?

java - @Transactional 如何影响 Hibernate 中的当前 session ?

java - 如何使用 lombok 为实体中嵌入类的成员变量分配默认值?

Javascript模板框架