java - Spring Boot JPA - No qualifying bean of type -
i'm learning spring , things going running issue cannot find qualified bean. hitting wall, in new app i'm getting this.
let me know if need more, going take break! must missing simple.
caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.alco.repository.contactrepository] found dependency [com.alco.repository.contactrepository]: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)}
my dependencies:
<dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-jpa</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-rest</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-hateoas</artifactid> </dependency> <dependency> <groupid>org.projectlombok</groupid> <artifactid>lombok</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-security</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>com.h2database</groupid> <artifactid>h2</artifactid> <scope>runtime</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> </dependencies>
contact class:
package com.example.entity; import java.io.serializable; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import lombok.allargsconstructor; import lombok.getter; import lombok.noargsconstructor; import lombok.setter; @entity @allargsconstructor @noargsconstructor @getter @setter public class contact implements serializable { private static final long serialversionuid = -1340978779095092824l; @id @generatedvalue(strategy=generationtype.auto) private string id; private string firstname; private string lastname; private string address; private string phonenumber; private string email; }
the simple interface:
package com.alco.repository; import org.springframework.data.jpa.repository.jparepository; import com.alco.entity.contact; public interface contactrepository extends jparepository<contact, string> { }
i think you're missing enabling of jpa repositories:
@componentscan(basepackageclasses = ...) @entityscan(basepackageclasses = ...) @enableautoconfiguration @enablejparepositories(basepackageclasses = ...) public class ... { }
this configuration class.
Comments
Post a Comment