How to autowire @service class ? No qualifying bean of type found for dependency
<p>What are the prerequisites to auto-wired any class without implementing any interface?</p>

<p>Class Diagrams</p>

<ol>
<li><p>MainClass -> Annotation used : <code>@SpringBootApplication @EnableTransactionalManagement</code></p></li>
<li><p>DatabaseConfig -> <code>@Configuration @EnableTransactionalManagement</code></p></li>
<li><p>UserRepository -> <code>@Repository</code></p></li>
<li><p>UserService -> <code>@Service</code> and <code>@Autowired UserRepository</code></p></li>
</ol>

<p>When I am writing test class with <code>@Autowired userRepository</code> it is working, but when I use <code>@Autowired UserService</code> and trying to call <code>userRepository</code> methods.</p>

<p>I am getting this error:</p>

<pre><code>Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: 
No qualifying bean of type [sm.services.AgendaService] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for this dependency. 
Dependency annotations: {@javax.inject.Inject()}
</code></pre>

<p><a href="http://i.stack.imgur.com/LHiOX.jpg" rel="nofollow">Project Structure</a></p>