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

o、 美国靴子。SpringApplication:Application run失败//我在这个网站上看到了答案,但它们帮不了我

管峻
2023-03-14

我的pom.xml当我添加这个依赖项时——我已经重新加载了我的项目并运行它。当我调试它时——它显示,. web包是红色的(找不到)。也许有些依赖项不正确,或者它们的版本不一样。

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>sk.Pipes</groupId>
    <artifactId>Pipes</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>


    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
    </parent>


    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>



        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

还有跑步课

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringClient {
    public static void main(String[] argv){
        SpringApplication.run(SpringClient.class);
    }
}

如果可以的话,请帮助我。或者如果你会发现我的错误,请写下如何纠正:)

这就是结果。

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.


2022-04-19 19:05:20.839  WARN 16848 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:C:\Users\Xiaomi\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.6.6\spring-boot-autoconfigure-2.6.6.jar!/org/springframework/boot/autoconfigure/r2dbc/ConnectionFactoryConfigurations$PoolConfiguration.class]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryConfigurations$PoolConfiguration due to io/r2dbc/spi/ValidationDepth not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
2022-04-19 19:05:20.839  INFO 16848 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-04-19 19:05:20.854 ERROR 16848 --- [           main] o.s.boot.SpringApplication               : Application run failed

共有1个答案

冯淳
2023-03-14

调试消息的第一行有答案,@SpringBootApplication注释类不能在默认包中。

创建java包并将该类重构为新包。

 类似资料:
  • 问题内容: 我试图让keytool.exe运行,但是一旦打开它,命令提示符就会消失得如此之快。 我也尝试手动在命令提示字元中输入 C:\ Program Files \ Java \ jdk1.6.0_25 \ bin 它表示“程序”未被识别为内部或外部命令,可操作程序或批处理文件。我无法打开程序文件夹本身。 我去了环境变量并更改了路径 1)C:\ Program Files \ Java \ j

  • 我有一个奇怪的问题。 我的Mac上安装了一台带有iOS 5.0.1(9A405)的iPad和带有Xcode 4.2(Build 4C199)的iOS SDK 5.0.1。 Xcode看不到我的设备。它说的是“iOS设备”而不是像往常一样的“索伦iPad”。 (我确信该设备已连接,因为我在iTunes中看到它。)Xcode拒绝在该设备上启动我的应用程序。它说: “Xcode无法使用所选设备运行。没有

  • 我用vscode写了一个java程序。但是我在java输出中得到了意想不到的答案。通常这个sout应该是6.6,但是java说6.6000000000000005。为什么

  • 问题内容: 这是我第一次真正使用列表和队列,因此这可能是一个非常简单的错误。是否因为我的队列中充满了无法转换为整数的对象? 问题答案: 除非您确实对性能至关重要,并且您使用了许多像int这样的原子类型,否则您确实应该使用Generics和ArrayList / ArrayDeque。然后,您应该看看 http://labs.carrotsearch.com/hppc.html

  • 有人能帮我解决这个错误吗?我的应用程序运行正常,但当点击活动按钮,它崩溃,出现此错误logcat。总之,我的. so文件在jniLibs文件夹中。 12-26 12:02:12.393 22612-22612/com.project.voicechangerE/AndroidRuntime: FATAL EXCEPTION:主进程:com.project.voicechanger, PID: 22