Tuesday, September 11, 2018

Spring: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ...: Unsatisfied dependency expressed through field


>PROBLEM
Starting the application, it stops working throwing the following exception:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ulteringController': Unsatisfied dependency expressed through field 'stateSvc'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'estadoSvc': Unsatisfied dependency expressed through field 'estadoRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'estadoRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract br.com.ultering.model.State br.com.ultering.model.repository.EstadoRepository.findBySigla(java.lang.String)!
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]


>SOLUTION

@Autowired
private StateSvc stateSvc;

ORIGINAL

@Service("estadoSvc")
@Transactional
public class StateSvcImpl extends AbstractSvc implements StateSvc {

FIXED

@Service("stateSvc")
@Transactional
public class StateSvcImpl extends AbstractSvc implements StateSvc {


>ENV
Windows
Spring Boot

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...