Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the error problem of starting springboot application because the database is not configured?

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to solve the error problem of starting springboot application because the database is not configured". The explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the error problem of starting springboot application due to unconfigured database".

Start the springboot application because the database is not configured for error description

Create a brand new springboot project and start the Times error for the first time. The specific error message is as follows:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2021-06-14 17 o.s.b.d.LoggingFailureAnalysisReporter 58 o.s.b.d.LoggingFailureAnalysisReporter 10.322 ERROR 12292-[main]:

* *

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

Solution

Option one

Add database configuration information to the application.properties configuration file

Spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource.url=jdbc:mysql://localhost:3306/guli?serverTimezone=GMT%2B8spring.datasource.username=cxspring.datasource.password=123456

Option 2

Declare in the startup class header declaration:

@ SpringBootApplication (exclude = DataSourceAutoConfiguration.class) springboot 1.5.8.RELEASE version startup error cause

The new spring boot project generates the project after selecting the 1.5.8.RELEASE version, and starts the project after configuring the application.properties. An error is reported.

Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable

At java.net.URLClassLoader.findClass (Unknown Source)

At java.lang.ClassLoader.loadClass (Unknown Source)

At sun.misc.Launcher$AppClassLoader.loadClass (Unknown Source)

At java.lang.ClassLoader.loadClass (Unknown Source)

Error troubleshooting

After searching by 1.ctrl+shift+t, we found that there was no such class.

two。 From the full name of this class, it can not be found that this class belongs to spring-core.jar.

3. The version of spring-core in maven dependencies is 4.3.12.RELEASE.

4. Online query shows that there is no such class in spring-core4.3.12.RELEASE.

Solution method

Find the spring-core version with this class. I use 4.3.9.RELEASE. Then add in the dependencies

Org.springframework spring-core 4.3.9.RELEASE thank you for your reading, the above is the content of "how to solve the problem of starting springboot application because the database is not configured". After the study of this article, I believe you have a deeper understanding of how to solve the problem of starting springboot application because the database is not configured, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 205

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report