Personally I have an error, when I run my application with the profile test, Spring Boot does not create the same database in the local profile. Any suggestion?
Here's my application-local.properties file:
# Hibernate
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.datasource.username=rw_itau
spring.datasource.password=rw_itau
spring.datasource.url=jdbc\:postgresql\://localhost/rw_itau
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=create-drop
And the application-test.properties file:
# Hibernate
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.datasource.username=rw_itau
spring.datasource.password=rw_itau
spring.datasource.url=jdbc\:postgresql\://localhost/rw_itau_teste
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=create-drop
In addition I have several classes as the initial class of SpringBoot:
package br.com.zup.rw.itau;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.stereotype.Controller;
@SpringBootApplication
@Controller
public class Boot
{
public static void main(String[] args)
{
SpringApplication.run(Boot.class, args);
}
}
I'm using Maven and Docker with Postgres Bank the error generated is this:
org.postgresql.util.PSQLException: FATAL: database "rw_itau_teste" does not exist
I run the project with this argument:
-Dspring.profiles.active=test
But when I run with the local argument, the database is created normally.
-Dspring.profiles.active=local
When I run the second error profile when connecting to the bank.