Learn springboot today and use idea to create projects. Mysq was added when selecting the component, and an error was reported when it was started for the first time. The error message is as follows:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified and no embedded datasource could be auto-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).
After multi-party verification, you need to add exclude in the @EnableAutoConfiguration or @SpringBootApplication of the startup class
= {DataSourceAutoConfiguration.class}, exclude this type of autoconfig. After starting, it can run normally.
This is because the database component is added, so autoconfig will read the data source configuration, and my newly created project has not yet configured the data source, so an exception will occur.
Solution to the problem 2: No need to change the adding statement, pay attention to the correctness of the project file structure
Read More:
- [Solved] Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
- [Solved] Failed to bind properties under ‘spring.datasource.type‘ to java.lang.Class<javax.sql.DataSource>
- Dyf Spring boot startup error: NoSuchBeanDefinitionException
- [How to Fix] Spring boot startup error: could not resolve placeholder
- Spring-boot Use dubbo Error: ERROR 8404 o.s.boot.SpringApplication:Application run failed
- [Solved] Mybatis Error: CannotFindDataSourceException: dynamic-datasource can not find primary datasource
- Causes of error in data transmission from spring boot to JSON
- Spring boot uses configuration interface webmvcconfigurer to solve cross domain problems
- Two implementation methods of spring boot scan mapper interface class
- Wildfly (JBoss) startup error: ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation (“add”) failed
- Spring Boot Druid Error: discard long time none received connection
- [neo4j] error report when visiting neo4j in spring boot project
- [Solved] Springboot Error creating bean with name ‘dataSource’ defined in class path resource
- SpringBoot startup error Failed to determine a suitable driver class
- IDEA generates Spring Boot project error: error: read timed out
- Error starting ApplicationContext. To display the auto-configuration report re-run your application
- Error running ‘PigSellCabinetApplication’: Command line is too long. Shorten command line for PigSellCabinetApplication or also for Spring Boot default configuration
- [Solved] spring boot – JPA–H2 Error: H2 error: “Syntax error in SQL statement … expected identifier“
- [Solved] spring boot security Start Error: ‘login.html?error‘ is not a valid redirect URL
- [Solved] Compile Error: “Configure: error: libtool configure failed”