Consider defining a bean of type 'service' in your configuration [Spring boot]

前端 未结 13 1566
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 01:35

I get error when I run the main class.

Error:

Action:
Consider defining a bean of type \'seconds47.service.TopicService\' in your c         


        
13条回答
  •  孤街浪徒
    2020-12-10 01:40

    I solved this issue by creating a bean for my service in SpringConfig.java file. Please check the below code,

    @Configuration 
    public class SpringConfig { 
    
    @Bean
    public TransactionService transactionService() {
        return new TransactionServiceImpl();
    }
    
    }
    

    The path of this file is shown in the below image, Spring boot application folder structure

提交回复
热议问题