当前位置: 首页 > 知识库问答 >
问题:

由于运行build.gradle文件,无法启动运行

苗冯浩
2023-03-14

我是Spring world的新手,刚刚将pom.xml更新到gradle中来管理所有的依赖项。

格雷迪被社区抛弃了吗?还有,这个错误可能的根本原因是什么。

刚刚意识到Spring Boot有很多令人困惑的错误消息。我真的不认为这种错误消息对任何开发人员都有帮助。对这种错误有什么想法或方向吗?

我只知道我换了球。xml转换为gradle并手动迁移配置文件。非常感谢!

异常在线程"main"java.lang.Abstract方法错误:接收器类org.springframework.boot.context.config.配置文件应用程序侦听器不定义或继承已解析方法的实现摘要支持SourceType(Ljava/lang/class;)Z接口org.springframework.context.event.SmartApplication ationListener。

buildscript {
    ext {
        springBootVersion = '2.1.9.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'dev.15house'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}


dependencies {
    compile group: 'org.modelmapper', name: 'modelmapper', version: '2.1.1'
    compile group: 'org.springframework', name: 'spring-context', version:'4.3.2.RELEASE'
    compile group: 'org.springframework', name: 'spring-webmvc', version:'4.3.2.RELEASE'
    compile("org.springframework.boot:spring-boot-starter-jetty:1.3.5.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-web:1.3.5.RELEASE")
    compile('mysql:mysql-connector-java')
    compile('org.springframework.boot:spring-boot-starter')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.springframework.boot:spring-boot-starter-test')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.restdocs:spring-restdocs-mockmvc')
    compile('org.springframework.security:spring-security-test')
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.9.4'
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version:'2.9.4'
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.9.4'
    runtime group: 'org.webjars', name: 'angularjs', version:'1.5.7'
    runtime group: 'org.webjars', name: 'bootstrap', version:'3.3.7'
}
> Task :bootRun FAILED
Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.springframework.boot.context.config.ConfigFileApplicationListener does not define or inherit an implementation of the resolved method abstract supportsSourceType(Ljava/lang/Class;)Z of interface org.springframework.context.event.SmartApplicationListener.
        at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:79)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.supportsEvent(AbstractApplicationEventMulticaster.java:282)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:214)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:185)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76)
        at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
        at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
        at dev.house.XprojApplication.main(XprojApplication.java:14)

共有1个答案

韦智刚
2023-03-14

我建议您从这里开始根据自己的需求生成项目。

在这里,您拥有所需的依赖项。

这是生成的build.gradle

plugins {
    id 'org.springframework.boot' version '2.1.9.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    runtimeOnly 'mysql:mysql-connector-java'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}
 类似资料:
  • 我有一个Java应用程序,它位于我编译为可执行jar文件的系统托盘中。我想在我的程序中添加添加到系统启动项的选项。 由于我不知道有什么统一的方法可以为所有操作系统做到这一点,我假设我必须为我打算支持的每个操作系统编写代码,所以我从Windows开始。 当我试图使用此处可用的代码将其添加到注册表中时,我发现在Windows 7和8下,除非我具有管理员权限(通过从提升的命令提示符运行),否则我对注册表

  • 我有个问题。我通过Java自动化代码运行SOAPUIWeb服务测试。但在那之后。硒不起作用。似乎soapUI部分实际上没有完成。但我不确定。 例外情况是: 然而,我将SoapUI部分注释掉。它会再次发挥作用。比如: 以下是我的SoapUI方法: 以下是硒的相关方法: 任何人都知道为什么会这样。我在谷歌上搜索。但在同样的情况下,似乎没有人会犯同样的错误。非常感谢你。

  • 问题内容: 我可以通过netbeans运行我的项目,但是在制作一个jar文件并双击它之后,我得到了错误,找不到Java运行时环境?我在Windows上。 问题答案: 您没有创建文件关联。右键单击Internet Explorer中的.jar文件,选择“打开方式”,然后导航到您的JRE。选择java.exe可执行文件,并确保命令行参数中存在“ -jar”。 .jar文件将作为第一个参数传递给JVM。

  • 我配置Jenkins与我的cucumber/Watir /Web驱动脚本 我的耙子文件看起来像这样..... 需要' Cucumber/Rake/task ' Cucumber::Rake::task . new(:features)do | t | t . Cucumber _ opts = ' *。“特征”结束 *我得到以下错误 :/Ruby193/bin/ruby-S bundle exec

  • 请注意,主类的run选项是灰色的。我试着重新启动intelliJ,重建,清理,一切。

  • 我一直在尝试启动NiFi,但每次我这样做,我都得到以下错误: