Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Cannot configure datasource: the ‘URL’ property is not specified, and the embedded datasource cannot be configured.
Obviously, you don’t configure some attributes of datasource in your application, such as address value, database driver, user name, password,
As we all know, the biggest advantage of springboot is automatic configuration: so we just need to give it the value of the configuration file, and it will be automatically configured. Configure in application.properties In the file
Then I will give you some of the most basic configuration information of springboot
#Accessing the root path
#app name
spring.application.name=springboot-demo
#port
server.port=8080
#encode
server.tomcat.uri-encoding=utf-8
#database
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/sql_test
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.max-idle=10
spring.datasource.max-wait=10000
spring.datasource.min-idle=5
spring.datasource.initial-size=5
#session
server.servlet.session.timeout=30m
Of course, you can not configure it, but you need to declare it
Just start the class header declaration:
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
Similar Posts:
- [Solved] Failed to bind properties under ” to com.zaxxer.hikari.Hikari DataSource Spring Boot
- SpringBoot Frame: Failed to determine a suitable driver class [How to Solve]
- [Solved] Spring Boot Error: “jdbcUrl is required with driverClassName.”
- Org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
- Solve the error of springboot failed to load ApplicationContext
- [Solved] Spring Error: java.sql.SQLException: Access denied for user ‘${user}’@’localhost’ (using password: YES)
- [Solved] Mybatis-config Error: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: failed to parse the connection string near ‘;useUnicode=true&
- Failed to obtain JDBC Connection
- [Solved] Spring Boot Startup Error: DataSourceProperties$DataSourceBeanCreationException
- Reason: Failed to determine a suitable driver class