Thanks for the reply. I put my code here:
My configuration:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.1.xsd">
<!-- Activate Spring Data JPA repository support -->
<jpa:repositories base-package="com.mypackage.repository" />
</beans>
My repository:
Code:
package com.mypackage.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import com.mypackage.pbo.PSubject;
public interface SubjectRepository extends JpaRepository<PSubject, String>{
public Page<PSubject> findByType(String title, Pageable pageable);
public Page<PSubject> findByType(String title);
public Page<PSubject> findByMacaddress(String macaddress, Pageable pageable);
public Page<PSubject> findByMacaddress(String macaddress);
public Page<PSubject> findByUri(String uri);
}
My service:
Code:
....
@Transactional
@Service("subjectService")
public class SubjectServiceImpl implements SubjectService
{
private final SubjectRepository subjectRepository;
@Autowired
public SubjectServiceImpl(SubjectRepository subjectRepository){
this.subjectRepository = subjectRepository;
}
It seems everything just like the example of spring site except I integrate it into my spring mvc project. But when starting my project, I got error:
org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [com.mypa.repository.SubjectRepository] found for dependency

Originally Posted by
dr_pompeii
Hello
Next time use code tags, and post here the complete error stack trace. The error is obvious, a missing bean dependency, I hope you have a correct configuration to scan the packages and get the annotated beans
Read the Spring Reference documentation for more details, there are many examples too