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

前端 未结 13 1365
伪装坚强ぢ
伪装坚强ぢ 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 02:01

    A class must have the @Component annotation or a derivation of that (like @Service, @Repository etc.) to be recognized as a Spring bean by the component scanning. So if you add @Component to the class, it should solve your problem.

    0 讨论(0)
提交回复
热议问题