Java 在本地主机上运行spring启动应用程序时出错
我试图在本地主机上运行我的spring boot应用程序,通常我第一次应该得到白标签错误页面,但我在运行它时遇到了这个错误Java 在本地主机上运行spring启动应用程序时出错,java,spring,spring-boot,Java,Spring,Spring Boot,我试图在本地主机上运行我的spring boot应用程序,通常我第一次应该得到白标签错误页面,但我在运行它时遇到了这个错误 *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: 'url' attribute is not specified and no embedded d
***************************
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).
Process finished with exit code 1
如日志所示,您必须检查数据源配置,并确保一切正常。如日志所示,您尝试在不提供数据库信息的情况下运行应用程序 Spring和Spring boot并非完全基于魔法
- 如果您使用嵌入式数据源(如您提供的日志中所述),他们可以猜测一些数据库信息,如
。如果要使用内存中的数据库运行应用程序,请在类路径上具有此依赖关系:url
希望有帮助 显示您的应用程序属性配置。这是一个新的springboot项目,我只更改了application.priperties文件中的服务器端口,与此服务器类似。port=9090正常情况下,它应该在不添加数据库或其他配置的情况下运行。如果它对您有效,请按此标记答案。它可能会帮助其他人。非常感谢。
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
spring.datasource.url=jdbc:postgresql://<database_host>:<port>/<database_name>
spring.datasource.username=myUser
spring.datasource.password=secret
spring.datasource.type= (Not necessary)