1
I searched Stackoverflow and Stackoverflow in Portuguese but nothing guaranteed the solution to the problem. I have been through this problem several times but at the moment I do not find the solution, follows:
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private br.com.treinamento.cadastros.repository.CategoriaRepository br.com.treinamento.cadastros.service.CategoriaService.repository; nested Exception is org.springframework.Beans.factory.Nosuchbeandefinitionexception: No Qualifying bean of type [br.com.treinamento.cadastros.Repository.Categoriarepository] 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)}
web xml.:
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="">
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/spring.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/spring.xml
</param-value>
</context-param>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<servlet-name>dispatcher</servlet-name>
</filter-mapping>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
</jsp-config>
Spring.xml:
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/task/spring-context-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="br.com.treinamento.cadastros.repository" />
<context:component-scan base-package="br.com.treinamento.cadastros.service" />
<context:component-scan base-package="br.com.treinamento.cadastros.controller" />
<context:component-scan base-package="br.com.treinamento.index.controller" />
<import resource="spring-mvc.xml" />
<import resource="spring-jpa.xml" />
Spring mvc.xml:
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="WEB-INF/i18n" />
<property name="defaultEncoding" value="UTF-8" />
<property name="useCodeAsDefaultMessage" value="true" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.FixedLocaleResolver">
<property name="defaultLocale" value="pt" />
</bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="2" />
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<mvc:annotation-driven />
<mvc:default-servlet-handler />
Categoriarepository.class:
package br.com.treinamento.cadastros.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import br.com.treinamento.cadastros.model.Categoria;
@Repository
public interface CategoriaRepository extends CrudRepository<Categoria, Integer> {
Page<Categoria> findByDescricaoLike(Pageable pageable, String name);
}
Categoriaservice.class:
package br.com.treinamento.cadastros.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.treinamento.cadastros.model.Categoria;
import br.com.treinamento.cadastros.repository.CategoriaRepository;
@Service
public class CategoriaService {
@Autowired(required = true)
private CategoriaRepository repository;
}
Categoriacontroller.class:
package br.com.treinamento.cadastros.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import br.com.treinamento.cadastros.model.Categoria;
import br.com.treinamento.cadastros.service.CategoriaService;
@Controller
@RequestMapping(value = "/privado/categorias")
public class CategoriaController {
@Autowired
private CategoriaService categoriaService;
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/html")
public String getCategoriasPage(){
return "/privado/cadastros/ListCategorias";
}
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json")
public boolean create(@ModelAttribute("categoria") Categoria categoria){
categoriaService.save(categoria);
return true;
}
}
Console:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building RevisaoWebMelhorias Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ RevisaoWebMelhorias ---
[INFO] Deleting /home/developer/workspace/RevisaoWebMelhorias/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ RevisaoWebMelhorias ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ RevisaoWebMelhorias ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 9 source files to /home/developer/workspace/RevisaoWebMelhorias/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ RevisaoWebMelhorias ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/developer/workspace/RevisaoWebMelhorias/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ RevisaoWebMelhorias ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ RevisaoWebMelhorias ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) @ RevisaoWebMelhorias ---
[INFO] Packaging webapp
[INFO] Assembling webapp [RevisaoWebMelhorias] in [/home/developer/workspace/RevisaoWebMelhorias/target/RevisaoWebMelhorias]
[INFO] Processing war project
[INFO] Webapp assembled in [98 msecs]
[INFO] Building war: /home/developer/workspace/RevisaoWebMelhorias/target/RevisaoWebMelhorias.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ RevisaoWebMelhorias ---
[INFO] Installing /home/developer/workspace/RevisaoWebMelhorias/target/RevisaoWebMelhorias.war to /home/developer/.m2/repository/br/com/treinamento/RevisaoWebMelhorias/0.0.1-SNAPSHOT/RevisaoWebMelhorias-0.0.1-SNAPSHOT.war
[INFO] Installing /home/developer/workspace/RevisaoWebMelhorias/pom.xml to /home/developer/.m2/repository/br/com/treinamento/RevisaoWebMelhorias/0.0.1-SNAPSHOT/RevisaoWebMelhorias-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.1:run (default-cli) > process-classes @ RevisaoWebMelhorias >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ RevisaoWebMelhorias ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ RevisaoWebMelhorias ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.1:run (default-cli) < process-classes @ RevisaoWebMelhorias <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.1:run (default-cli) @ RevisaoWebMelhorias ---
[INFO] Running war on http://localhost:8080/RevisaoWebMelhorias
[INFO] Creating Tomcat server configuration at /home/developer/workspace/RevisaoWebMelhorias/target/tomcat
[INFO] Coping additional tomcat config files
[INFO] copy context.xml
[INFO] copy log4j.xml
[INFO] setting SystemProperties:
[INFO] log4j.configuration=file:./src/main/webapp/WEB-INF/tomcat/conf/log4j.xml
[INFO] create webapp with contextPath: /RevisaoWebMelhorias
Fev 26, 2016 11:05:58 AM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-bio-8080"]
Fev 26, 2016 11:05:58 AM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Tomcat
Fev 26, 2016 11:05:58 AM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/7.0.37
Fev 26, 2016 11:06:02 AM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: No Spring WebApplicationInitializer types detected on classpath
Fev 26, 2016 11:06:02 AM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Initializing Spring root WebApplicationContext
[INFO] Root WebApplicationContext: initialization started
[INFO] Refreshing Root WebApplicationContext: startup date [Fri Feb 26 11:06:02 BRT 2016]; root of context hierarchy
[INFO] Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/spring.xml]
[INFO] Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/spring-mvc.xml]
[INFO] Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/spring-jpa.xml]
[INFO] JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
log4j:ERROR No appender named [FILE] could be found.
log4j:ERROR No appender named [ASYNC] could be found.
log4j:ERROR No appender named [FILE] could be found.
log4j:ERROR No appender named [ASYNC] could be found.
[INFO] Building JPA container EntityManagerFactory for persistence unit 'RevisaoWebMelhoriasPU'
WARN [org.hibernate.ejb.HibernatePersistence] [] localhost-startStop-1 HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
INFO [org.hibernate.jpa.internal.util.LogHelper] [] localhost-startStop-1 HHH000204: Processing PersistenceUnitInfo [
name: RevisaoWebMelhoriasPU
...]
INFO [org.hibernate.Version] [] localhost-startStop-1 HHH000412: Hibernate Core {5.1.0.Final}
INFO [org.hibernate.cfg.Environment] [] localhost-startStop-1 HHH000206: hibernate.properties not found
INFO [org.hibernate.cfg.Environment] [] localhost-startStop-1 HHH000021: Bytecode provider name : javassist
INFO [org.hibernate.annotations.common.Version] [] localhost-startStop-1 HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
INFO [org.hibernate.dialect.Dialect] [] localhost-startStop-1 HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL82Dialect
INFO [org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl] [] localhost-startStop-1 HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
INFO [org.hibernate.type.BasicTypeRegistry] [] localhost-startStop-1 HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@7bc08345
INFO [org.hibernate.validator.internal.util.Version] [] localhost-startStop-1 HV000001: Hibernate Validator 5.1.0.Final
[WARNING] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoriaService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private br.com.treinamento.cadastros.repository.CategoriaRepository br.com.treinamento.cadastros.service.CategoriaService.repository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.com.treinamento.cadastros.repository.CategoriaRepository] 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)}
[INFO] Closing JPA EntityManagerFactory for persistence unit 'RevisaoWebMelhoriasPU'
[ERROR] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoriaService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private br.com.treinamento.cadastros.repository.CategoriaRepository br.com.treinamento.cadastros.service.CategoriaService.repository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.com.treinamento.cadastros.repository.CategoriaRepository] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private br.com.treinamento.cadastros.repository.CategoriaRepository br.com.treinamento.cadastros.service.CategoriaService.repository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.com.treinamento.cadastros.repository.CategoriaRepository] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 22 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.com.treinamento.cadastros.repository.CategoriaRepository] 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)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 24 more
Fev 26, 2016 11:06:08 AM org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoriaService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private br.com.treinamento.cadastros.repository.CategoriaRepository br.com.treinamento.cadastros.service.CategoriaService.repository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.com.treinamento.cadastros.repository.CategoriaRepository] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private br.com.treinamento.cadastros.repository.CategoriaRepository br.com.treinamento.cadastros.service.CategoriaService.repository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.com.treinamento.cadastros.repository.CategoriaRepository] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 22 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [br.com.treinamento.cadastros.repository.CategoriaRepository] 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)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 24 more
Fev 26, 2016 11:06:08 AM org.apache.catalina.core.StandardContext startInternal
GRAVE: Error listenerStart
Fev 26, 2016 11:06:08 AM org.apache.catalina.core.StandardContext startInternal
GRAVE: Context [/RevisaoWebMelhorias] startup failed due to previous errors
Fev 26, 2016 11:06:08 AM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Closing Spring root WebApplicationContext
Fev 26, 2016 11:06:08 AM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-bio-8080"]
Apparently it’s all right, what can it be?
My friend, I don’t know why either, but have you ever tried to create a java for this Pository? It seems to me that as there is no way to instantiate an interface, the
Spring
ñ can find an object to link to@Autowired
. What you would need to do is, create a java, implement the interface, take the Repository out of the interface, and put in the new java file. I wouldn’t even have to touch@Autowired
.– Gustavo Cinque
In this example you are instantiating an interface: http://docs.spring.io/spring-data/data-commons/docs/1.1.RELEASE/reference/html/repositories.html
– Giancarlo Abel Giulian