问题描述
今天当我使用 Spring Boot 重新启动我的应用程序时,控制台提示
Execution Failed for task ':Application.main()'.
> Process 'command 'C:/Java/jdk8/bin/java.exe'' finished with non-zero exit value 1
我不知道如何解决这个问题
这是我的application.java
和application.yaml
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class,args);
}
}
server:
port: 80
Spring Boot 和 Gradle 的版本是 2.3.7.RELEASE 和 6.1.1
有什么想法吗?
解决方法
好的,我已经解决了这个问题,我会分享给你的。
在gradle缓存文件中,我发现了一些类似下面的日志
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded
datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2,HSQL or Derby),please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
FAILURE: Build failed with an exception.
这个问题是我没有一些用于 SpringBoot 启动的数据库配置。 所以当我在资源文件夹中添加数据库配置并创建了一个 application.yaml 文件时,然后启动成功。
就这样吧,也许下次我们可以先添加配置文件或者我们自己配置日志。