2

Tengo un error al momento de iniciar mi aplicación creada con Spring Boot v2.5.6. Tengo la siguiente tabla en una base de datos ya existente en Oracle 11g.

introducir la descripción de la imagen aquí

Estoy desarrollando una API con arquitectura REST con Spring Web, Oracle Driver, Spring Data JPA y Lombok. He creado el siguiente modelo

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "USUARIO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Usuario {
    @Id
    @Column(name = "ID_USU")
    private Long idUsu;
    @Column(name = "ID_PERFIL")
    private Long idPerfil;
    @Column(name = "USERNAME", length = 15)
    private String username;
    @Column(name = "PASSWORD", length = 250)
    private String password;
    @Column(name = "RUN_USU")
    private Long rut;
    @Column(name = "NOMBRE_USU", length = 60)
    private String nombre;
    @Column(name = "AP_PATERNO_USU", length = 60)
    private String aPaterno;
    @Column(name = "AP_MATERNO_USU", length = 60)
    private String aMaterno;
    @Column(name = "FONO_USU", length = 15)
    private String telefono;
    @Column(name = "MAIL_USU", length = 60)
    private String correo;
    @Column(name = "APP_USU", length = 2)
    private char app;
    @Column(name = "ACTIVO_USU", length = 1)
    private char activo;
    @Column(name = "INI_USU", length = 1)
    private char ini;
    @Column(name = "ID_SIGE")
    private Long idSige;
    @Column(name = "HASH_REC", length = 20)
    private String hash;
    @Column(name = "R_CERTIFICADO", length = 500)
    private String certificado;

}

Luego he creado el siguiente repositorio y los respectivos servicios con su interfaz.

import org.springframework.data.jpa.repository.JpaRepository;

public interface UsuarioRepo extends JpaRepository<Usuario, Long> {
    Usuario encontrarPorNombreDeUsuario(String username);
}

import java.util.List;

public interface UsuarioServicio {
    Usuario insertarUsuario(Usuario u);

    Usuario getUser(String username);

    List<Usuario> obtenerTodosLosUsuarios();
}

package cl.gob.interior.sirc.servicio;

import cl.gob.interior.sirc.dominio.Usuario;
import cl.gob.interior.sirc.repositorio.UsuarioRepo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@RequiredArgsConstructor
@Transactional
@Slf4j
public class UsuarioServicioImplementacion implements UsuarioServicio {

    private final UsuarioRepo usuarioRepo;

    @Override
    public Usuario insertarUsuario(Usuario u) {
        log.info("Se ha guardado el usuario {} en la base de datos", u.getUsername());
        return usuarioRepo.save(u);
    }

    @Override
    public Usuario getUser(String username) {
        log.info("Se esta buscando el usuario con nombre de usuario = {}", username);
        return usuarioRepo.encontrarPorNombreDeUsuario(username);
    }

    @Override
    public List<Usuario> obtenerTodosLosUsuarios() {
        log.info("Se estan buscando todos los usuarios");
        return usuarioRepo.findAll();
    }
}

Para ultimo implementar un ControladorRest

package cl.gob.interior.sirc.api;

import cl.gob.interior.sirc.dominio.Usuario;
import cl.gob.interior.sirc.servicio.UsuarioServicio;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Usuario")
@RequiredArgsConstructor
public class UsuarioRecurso {
    private final UsuarioServicio usuarioServicio;

    @GetMapping("/Login")
    public ResponseEntity<List<Usuario>> getUsuarios() {
        return ResponseEntity.ok().body(usuarioServicio.obtenerTodosLosUsuarios());
    }
}

Hasta aquí todo debería funcionar bien, el problema que cuando arranco la aplicación en modo spring boot me arroja el siguiente error en la ejecución del programa:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'usuarioRecurso' defined in file [C:\Users\Juan Fernando\Desktop\proyectos\sirc\target\classes\cl\gob\interior\sirc\api\UsuarioRecurso.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'usuarioServicioImplementacion' defined in file [C:\Users\Juan Fernando\Desktop\proyectos\sirc\target\classes\cl\gob\interior\sirc\servicio\UsuarioServicioImplementacion.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usuarioRepo' defined in cl.gob.interior.sirc.repositorio.UsuarioRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! Reason: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.12.jar:5.3.12]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.12.jar:5.3.12]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.6.jar:2.5.6]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.6.jar:2.5.6]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.6.jar:2.5.6]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.6.jar:2.5.6]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.6.jar:2.5.6]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.6.jar:2.5.6]
    at cl.gob.interior.sirc.SircApplication.main(SircApplication.java:10) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_291]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_291]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_291]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_291]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.5.6.jar:2.5.6]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'usuarioServicioImplementacion' defined in file [C:\Users\Juan Fernando\Desktop\proyectos\sirc\target\classes\cl\gob\interior\sirc\servicio\UsuarioServicioImplementacion.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usuarioRepo' defined in cl.gob.interior.sirc.repositorio.UsuarioRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! Reason: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.12.jar:5.3.12]
    ... 24 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usuarioRepo' defined in cl.gob.interior.sirc.repositorio.UsuarioRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! Reason: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.12.jar:5.3.12]
    ... 38 common frames omitted
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! Reason: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!
    at org.springframework.data.repository.query.QueryCreationException.create(QueryCreationException.java:101) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:106) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(QueryExecutorMethodInterceptor.java:94) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_291]
    at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[na:1.8.0_291]
    at java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1051) ~[na:1.8.0_291]
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_291]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_291]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_291]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:96) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:86) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at java.util.Optional.map(Optional.java:215) ~[na:1.8.0_291]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.<init>(QueryExecutorMethodInterceptor.java:86) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:360) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:323) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:230) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:329) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:144) ~[spring-data-jpa-2.5.6.jar:2.5.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.12.jar:5.3.12]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.12.jar:5.3.12]
    ... 49 common frames omitted
Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract cl.gob.interior.sirc.dominio.Usuario cl.gob.interior.sirc.repositorio.UsuarioRepo.encontrarPorNombreDeUsuario(java.lang.String)! No property encontrarPorNombreDeUsuario found for type Usuario!
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:96) ~[spring-data-jpa-2.5.6.jar:2.5.6]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:113) ~[spring-data-jpa-2.5.6.jar:2.5.6]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:254) ~[spring-data-jpa-2.5.6.jar:2.5.6]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:87) ~[spring-data-jpa-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:102) ~[spring-data-commons-2.5.6.jar:2.5.6]
    ... 71 common frames omitted
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property encontrarPorNombreDeUsuario found for type Usuario!
    at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:90) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:437) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:413) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:366) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324) ~[na:1.8.0_291]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:348) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:331) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.query.parser.Part.<init>(Part.java:81) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:249) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_291]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[na:1.8.0_291]
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_291]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_291]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_291]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:250) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:383) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_291]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[na:1.8.0_291]
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_291]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_291]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_291]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_291]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:384) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:92) ~[spring-data-commons-2.5.6.jar:2.5.6]
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:89) ~[spring-data-jpa-2.5.6.jar:2.5.6]
    ... 75 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:54545', transport: 'socket'

Process finished with exit code 0

2
  • 1
    Siento decirte que Spring no habla español: si el método del repository se llamara findByUsername seguramente te funcionará Commented el 24 oct. 2021 a las 8:47
  • Sí, investigando logré dar con la solución. En el repositorio para buscar una entidad por alguna propiedad tiene que ser igual a la propiedad de la clase. Por ejemplo, username, en el repo debe ser findByUsername(); Obviamente, con los métodos en ingles. Commented el 24 oct. 2021 a las 14:58

1 respuesta 1

3

Un par de observaciones:

  1. encontrarPorNombreDeUsuario en el repositorio no debería estar en inglés? findByName

  2. En usuarioServicioImplementacion, declaras esto: private final UsuarioRepo usuarioRepo;

no deberías agregarlo al constructor, dado que estás haciendo una inyeccion de dependencia por constructor, lo mimso aplica para tu controlador. De la siguiente manera

private final UsuarioServicio usuarioServicio;

public UsuarioRecurso (UsuarioServicio usuarioServicio) {
    this.usuarioServicio= usuarioServicio;
}

Este ejemplo en el controlador, hacer lo mismo para el repositorio.

  1. No creaste tu sequenceGenerator en tu entidad y tampoco tu generatedValue en el id de tu entidad.

Finalmente, asegurate de tener las dependencias correctas en tu pom.xml

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.