No qualifying bean of type UserRepository found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency
<p>Hey I have problem with extending repository from <code>Spring data</code>.</p>

<p>I have controller that talks with service layer:</p>

<pre><code>@RestController
public class UserController {
    @Autowired
    public UserService userService;

    @RequestMapping(value = ServerRouting.UserService.getList, method = RequestMethod.GET)
    public @ResponseBody Iterable&lt;UserEntity&gt; getList() {
        return userService.getList();
    }
}
</code></pre>

<p>here is service layer:</p>

<pre><code>@Service
public class UserService {
    @Autowired
    public UserRepository repository;

    @Transactional
    public Iterable&lt;UserEntity&gt; getList() {
        return repository.findAll();
    }
}
</code></pre>

<p>service layer talks to repository/dao layer. Repository is an interface that extends <code>org.springframework.data.repository;CrudRepository</code> from spring data:</p>

<pre><code>@Repository
public interface UserRepository extends CrudRepository&lt;UserEntity, Long&gt; {}
</code></pre>

<p>In this crud repository are methods that I would like to use, f.e <code>findAll()</code>
But when I run this project on tomcat, I am getting an error:</p>

<pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public pl.korbeldaniel.cms.server.service.UserService pl.korbeldaniel.cms.server.controller.UserController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public pl.korbeldaniel.cms.server.dao.UserRepository pl.korbeldaniel.cms.server.service.UserService.repository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [pl.korbeldaniel.cms.server.dao.UserRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
</code></pre>

<p>I think the problem is related with this: <code>No qualifying bean of type [pl.korbeldaniel.cms.server.dao.UserRepository] found for dependency</code>.
cause I do not have an repository implementation that could be injected, but for me it is the point of using spring-data: just to create simple interface, as in this <a href="https://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-part-two-crud/" rel="nofollow">example</a></p>

<p>Here is my persistence configuration:</p>

<pre><code>package pl.korbeldaniel.cms.server.config;

import java.util.Properties;
import javax.annotation.Resource;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

@Configuration
@EnableJpaRepositories(basePackages = { "pl.korbeldaniel.cms.server;" })
@PropertySource("classpath:application.properties")
@EnableTransactionManagement
class PersistenceContext {
    @Resource
    private Environment env;

    @Bean(destroyMethod = "close")
    DataSource dataSource(Environment env) {
        HikariConfig dataSourceConfig = new HikariConfig();
        dataSourceConfig.setDriverClassName(env.getRequiredProperty("db.driver"));
        dataSourceConfig.setJdbcUrl(env.getRequiredProperty("db.url"));
        dataSourceConfig.setUsername(env.getRequiredProperty("db.username"));
        dataSourceConfig.setPassword(env.getRequiredProperty("db.password"));
        return new HikariDataSource(dataSourceConfig);
    }
    @Bean
    LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, Environment env) {
        LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
        entityManagerFactoryBean.setDataSource(dataSource);
        entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
        entityManagerFactoryBean.setPackagesToScan("pl.korbeldaniel.cms.server");
        Properties jpaProperties = new Properties();
        //Configures the used database dialect. This allows Hibernate to create SQL
        //that is optimized for the used database.
        jpaProperties.put("hibernate.dialect", env.getRequiredProperty("hibernate.dialect"));
        //Specifies the action that is invoked to the database when the Hibernate
        //SessionFactory is created or closed.
        jpaProperties.put("hibernate.hbm2ddl.auto", env.getRequiredProperty("hibernate.hbm2ddl.auto"));
        //Configures the naming strategy that is used when Hibernate creates
        //new database objects and schema elements
        jpaProperties.put("hibernate.ejb.naming_strategy", env.getRequiredProperty("hibernate.ejb.naming_strategy"));
        //If the value of this property is true, Hibernate writes all SQL
        //statements to the console.
        jpaProperties.put("hibernate.show_sql", env.getRequiredProperty("hibernate.show_sql"));
        //If the value of this property is true, Hibernate will format the SQL
        //that is written to the console.
        jpaProperties.put("hibernate.format_sql", env.getRequiredProperty("hibernate.format_sql"));
        entityManagerFactoryBean.setJpaProperties(jpaProperties);

        return entityManagerFactoryBean;
    }
    @Bean
    JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
        JpaTransactionManager transactionManager = new JpaTransactionManager();
        transactionManager.setEntityManagerFactory(entityManagerFactory);
        return transactionManager;
    }
}
</code></pre>

<p>Please help.</p>