Olá, Tudo bem? Estou tomando o seguinte erro ao executar o LeilaoApplication:
:: Spring Boot :: (v2.3.1.RELEASE)
2024-07-25 18:24:56.994 WARN 3243 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
Esse erro começou a ocorrer após adicionar o profile "test" no run configurarion, sem o profile a aplicação roda mas não inicia corretamente. Até segui a dica do tipico a seguir, mas não deu certo: https://cursos.alura.com.br/forum/topico-erro-ao-executar-o-projeto-spring-jpa-open-in-view-is-enabled-by-default-therefore-database-queries-may-be-performed-during-view-rendering-196452
O erro passou a ser esse após as alteração sugeridas no tópico acima: :: Spring Boot :: (v2.3.1.RELEASE)
2024-07-25 18:31:27.041 WARN 3294 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2024-07-25 18:31:27.066 WARN 3294 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfigProfileTest': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'openEntityManagerInViewInterceptorConfigurer' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration$JpaWebConfiguration.class]: Unsatisfied dependency expressed through method 'openEntityManagerInViewInterceptorConfigurer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openEntityManagerInViewInterceptor' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration$JpaWebConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [br/com/alura/leilao/security/WebSecurityConfigProfileTest.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Circular reference involving containing bean 'webSecurityConfigProfileTest' - consider declaring the factory method as static for independence from its containing instance. Factory method 'entityManagerFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [br/com/alura/leilao/security/WebSecurityConfigProfileTest.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Circular reference involving containing bean 'webSecurityConfigProfileTest' - consider declaring the factory method as static for independence from its containing instance. Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver] 2024-07-25 18:31:27.090 ERROR 3294 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed