1
resposta

O Projeto não esta funcionando pode me ajuda?

duvida

por que estar acontecendo isso por favor pode me ajuda

Exception in thread "task-2" org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'delegatingApplicationListener': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:245) at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:197) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361) at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.publishEventIfRequired(DataSourceInitializedPublisher.java:99) at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.access$100(DataSourceInitializedPublisher.java:50) at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher$DataSourceSchemaCreatedPublisher.lambda$postProcessEntityManagerFactory$0(DataSourceInitializedPublisher.java:200) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

OUTRO ERRRO

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2022-06-23 12:20:09.715 ERROR 15400 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Parameter 1 of constructor in br.com.alura.leilao.service.GeradorDePagamento required a bean of type 'java.time.Clock' that could not be found.

Action:

Consider defining a bean of type 'java.time.Clock' in your configuration.

1 resposta

Oi Moisés,

Rodando os testes o erro não ocorre, pois o Clock definimos com sendo um mock que o Mockito vai criar.

Mas se você rodar a aplicação, e não mais os testes, vai acontecer esse erro, pois precisamos configurar no projeto esse objeto Mock. Como não era o foco do curso executar a aplicação e entender coisas do Spring, framework utilizado na aplicação, acabei não mostrando esse problema.

Mas você pode resolver criando essa classe:

@Configuration
public class ClockConfiguration {

    @Bean
    public Clock getClock() {
        return Clock.systemDefaultZone();
    }
}