Eai pessoa!
Estou tentando subir uma aplicação e estou tendo o erro acima. Estou enviando o erro completo para vocês:
***************************
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 0
Pesquisando, vejo que o erro está nas configurações do application.yml. Já testei tanto com o yml quanto com o properties, e o erro persiste. Já revisei também minha url e também está correta, assim como o driver do mysql no pom. Vou deixar o link do projeto no git mas também vou subir o pom e o application pra melhor visualização.
application.yml:
spring:
datasource:
dbcp2:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/rest_with_spring_boot
username: root
password: 123456
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
show-sql: false
pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>br.com.erudio</groupId>
<artifactId>rest-with-spring-boot-and-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>rest-with-spring-boot-and-java</name>
<description>Curso de Spring boot </description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>```
Segue também o link do projeto no github pra quem quiser ver melhor: https://github.com/LucasCandidoMcz098/rest-with-spring-boot-and-java