问题描述
我正在关注Spring教程,当我尝试启动spring应用程序时出现以下错误:
I'm following a Spring tutorial, and when I tried to start the spring application I got the following error:
2016-01-20 23:18:15.911 INFO 5271 --- [main]
osboot.SpringApplication:没有活动的个人资料集,
回到默认个人资料:默认
2016-01-20 23:18:15.911 INFO 5271 --- [ main] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2016-01-20 23:18:15.918 ERROR 5271 --- [main]
osboot.SpringApplication:应用程序启动失败
java.lang .IllegalArgumentException:
org.springframework.util.Assert.notEmpty(Assert.java:276)
~ [spring-core-4.2.4.RELEASE.jar:4.2.4 .RELEASE] at
org.springframework.boot.SpringApplication.doRun(SpringApplication.java:352)
[spring-boot-1.3.1.RELEASE.jar:1.3.1.RE租赁在
org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
org.springframework.boot.SpringApplication.run(SpringApplication.java:1124)
[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
org.springframework.boot .SpringApplication.main(SpringApplication.java:1140)
[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
2016-01-20 23:18:15.918 ERROR 5271 --- [ main] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalArgumentException: Sources must not be empty at org.springframework.util.Assert.notEmpty(Assert.java:276) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:352) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.main(SpringApplication.java:1140) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
这是什么源不能为空错误?
What is this "Sources must not be empty" error?
我正在为本教程项目使用Eclipse-Maven项目,我已更新该项目。我还清理并重建了但是我仍然遇到了这个错误。
I am using an Eclipse - Maven project for this tutorial project and I have updated the project. I have also cleaned and rebuilt but I still got this error.
推荐答案
事实证明我没有正确设置主类在Eclipse中 - 调试和运行配置。我将org.springframework.boot.SpringApplication设置为主类。 Main类应该指向我的主类。
It turns out that I did not set the main class correctly in Eclipse - Debug, and Run configuration. I set org.springframework.boot.SpringApplication as the main class. The Main class should be pointing to my main class.
这篇关于Spring应用程序启动错误:源不能为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!