Error after using Flyway in project

Asked

Viewed 27 times

-1

As I said on this topic Project flyway and jpa-Ibernate getting confused, includes in our project the Flyway,

After correctly running Flyway and the project create the tables, insert, change and delete sql.

When Spring starts, it gives the error below. Only before this error did not happen, informed below.

What can it be ?

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-03-07 10:46:18.868 ERROR 14028 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaUsuarioRestController': Unsatisfied dependency expressed through field 'incluisao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaUsuarioInclusaoController': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaServiceImpl': Unsatisfied dependency expressed through field 'pessoaUsuarioService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaUsuarioServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pessoaUsuarioRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario br.com.ghsistemas.usuarios.core.pessoausuario.impl.PessoaUsuarioRepository.findByByPessoaAndUsuario(br.com.ghsistemas.usuarios.core.pessoa.Pessoa,br.com.ghsistemas.usuarios.core.usuario.Usuario)! No property byPessoa found for type PessoaUsuario!
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
    at br.com.ghsistemas.usuarios.UsuariosApplication.main(UsuariosApplication.java:14) [classes/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaUsuarioInclusaoController': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaServiceImpl': Unsatisfied dependency expressed through field 'pessoaUsuarioService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaUsuarioServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pessoaUsuarioRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario br.com.ghsistemas.usuarios.core.pessoausuario.impl.PessoaUsuarioRepository.findByByPessoaAndUsuario(br.com.ghsistemas.usuarios.core.pessoa.Pessoa,br.com.ghsistemas.usuarios.core.usuario.Usuario)! No property byPessoa found for type PessoaUsuario!
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 19 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaServiceImpl': Unsatisfied dependency expressed through field 'pessoaUsuarioService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaUsuarioServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pessoaUsuarioRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario br.com.ghsistemas.usuarios.core.pessoausuario.impl.PessoaUsuarioRepository.findByByPessoaAndUsuario(br.com.ghsistemas.usuarios.core.pessoa.Pessoa,br.com.ghsistemas.usuarios.core.usuario.Usuario)! No property byPessoa found for type PessoaUsuario!
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 32 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pessoaUsuarioServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pessoaUsuarioRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario br.com.ghsistemas.usuarios.core.pessoausuario.impl.PessoaUsuarioRepository.findByByPessoaAndUsuario(br.com.ghsistemas.usuarios.core.pessoa.Pessoa,br.com.ghsistemas.usuarios.core.usuario.Usuario)! No property byPessoa found for type PessoaUsuario!
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 45 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pessoaUsuarioRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario br.com.ghsistemas.usuarios.core.pessoausuario.impl.PessoaUsuarioRepository.findByByPessoaAndUsuario(br.com.ghsistemas.usuarios.core.pessoa.Pessoa,br.com.ghsistemas.usuarios.core.usuario.Usuario)! No property byPessoa found for type PessoaUsuario!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 58 common frames omitted
Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario br.com.ghsistemas.usuarios.core.pessoausuario.impl.PessoaUsuarioRepository.findByByPessoaAndUsuario(br.com.ghsistemas.usuarios.core.pessoa.Pessoa,br.com.ghsistemas.usuarios.core.usuario.Usuario)! No property byPessoa found for type PessoaUsuario!
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:84) ~[spring-data-jpa-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:106) ~[spring-data-jpa-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:211) ~[spring-data-jpa-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:79) ~[spring-data-jpa-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:566) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:559) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_131]
    at java.util.Iterator.forEachRemaining(Unknown Source) ~[na:1.8.0_131]
    at java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Unknown Source) ~[na:1.8.0_131]
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[na:1.8.0_131]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:561) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:551) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at java.util.Optional.map(Unknown Source) ~[na:1.8.0_131]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:551) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:211) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.util.Lazy.get(Lazy.java:94) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:121) ~[spring-data-jpa-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 68 common frames omitted
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property byPessoa found for type PessoaUsuario!
    at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:94) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:382) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:358) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:311) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at java.util.concurrent.ConcurrentMap.computeIfAbsent(Unknown Source) ~[na:1.8.0_131]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:293) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:276) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.query.parser.Part.<init>(Part.java:81) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:250) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) ~[na:1.8.0_131]
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[na:1.8.0_131]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:251) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:380) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) ~[na:1.8.0_131]
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[na:1.8.0_131]
    at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[na:1.8.0_131]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:381) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:96) ~[spring-data-commons-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:78) ~[spring-data-jpa-2.1.10.RELEASE.jar:2.1.10.RELEASE]
    ... 94 common frames omitted
  • Hard to look only at the log, check if your validation bean is using the correct Imports in the case javax.persistence. * to better detail put your migrations, Resource is in question. services and entities.

  • @Andrémartins put the codes. in the answer.

1 answer

0

Personal user

package br.com.ghsistemas.usuarios.rest.pessoausuario;

import br.com.ghsistemas.principal.utilitario.mensagem.Mensagem;
import br.com.ghsistemas.usuarios.core.exception.PessoaException;
import br.com.ghsistemas.usuarios.core.pessoa.resource.PessoaEnvioResource;
import br.com.ghsistemas.usuarios.core.pessoa.resource.PessoaFiltroResource;
import br.com.ghsistemas.usuarios.core.pessoa.resource.PessoaPaginacaoResource;
import br.com.ghsistemas.usuarios.core.pessoa.resource.PessoaRetornoResource;
import br.com.ghsistemas.usuarios.core.usuario.resource.UsuarioAlterarSenhaEnvioResource;
import br.com.ghsistemas.usuarios.core.usuario.resource.UsuarioAlterarSenhaRetornoResource;
import br.com.ghsistemas.usuarios.rest.UsuariosController;
import br.com.ghsistemas.usuarios.rest.pessoausuario.controller.PessoaUsuarioInclusaoController;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;

import static br.com.ghsistemas.principal.utilitario.constantes.ConstantesUtil.*;
import static br.com.ghsistemas.usuarios.utilitario.constantes.Constantes.*;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;

@CommonsLog
@RestController
@RequestMapping("/pessoasUsuarios")
public class PessoaUsuarioRestController extends UsuariosController {

    @Autowired
    private PessoaUsuarioInclusaoController incluisao;

    @PostMapping(value = "/incluir", produces = APPLICATION_JSON_UTF8_VALUE)
    @ResponseStatus(code = CREATED)
    //@PreAuthorize("hasAnyRole('ROLE_ADMINISTRADOR)")
    public ResponseEntity<?> incluir(@RequestBody PessoaEnvioResource resource) throws PessoaException {
        try {
            resource.setLoginUsuario(retornLoginContexto().getUsername());
            PessoaRetornoResource incluir = incluisao.incluir(resource);
            incluir.setMensagens(mensagemSalvar(false));
            return new ResponseEntity<>(incluir, OK);
        } catch (PessoaException e) {
            return excecaoPessoaUsuario(e);
        } catch (Exception e) {
            return excecaoGeral(e, ERRO_PESSOA_USUARIO_CHAVE + INCLUIR_CHAVE,
                    ERRO_EM + INCLUIR + PESSOA_USUARIO + EXCLAMACAO);
        }
    }

    private PessoaEnvioResource preencherResource(String id) {
        PessoaEnvioResource resource = PessoaEnvioResource.builder().build();
        resource.setLoginUsuario(retornLoginContexto().getUsername());
        resource.setId(id);
        return resource;
    }

    private ResponseEntity<?> excecaoPessoaUsuario(PessoaException e) {
        log.error(e.getMessage(), e);
        Collection<Mensagem> mensagems = mensagemSalvar(true);
        mensagems.addAll(e.getMensagens());
        return new ResponseEntity<>(mensagems, CONFLICT);
    }
}

PessoaUsuarioInclusaoController

package br.com.ghsistemas.usuarios.rest.pessoausuario.controller;

import br.com.ghsistemas.principal.utilitario.mensagem.Mensagem;
import br.com.ghsistemas.usuarios.core.exception.PessoaException;
import br.com.ghsistemas.usuarios.core.pessoa.PessoaService;
import br.com.ghsistemas.usuarios.core.pessoa.resource.PessoaEnvioResource;
import br.com.ghsistemas.usuarios.core.pessoa.resource.PessoaRetornoResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collection;

@Component
public class PessoaUsuarioInclusaoController {

    @Autowired
    private PessoaService service;

    public PessoaRetornoResource incluir(PessoaEnvioResource pessoaEnvioResource) throws PessoaException {
        Collection<Mensagem> mensagens = new ArrayList<>();
        return service.incluir(pessoaEnvioResource, mensagens);
    }
}

Personal service

package br.com.ghsistemas.usuarios.core.pessoausuario;

import java.util.Collection;

import br.com.ghsistemas.principal.utilitario.mensagem.Mensagem;
import br.com.ghsistemas.usuarios.core.pessoausuario.resource.PessoaUsuarioResource;

public interface PessoaUsuarioService {

    void incluir(PessoaUsuarioResource resource, Collection<Mensagem> mensagens);
}

Personal Usersserviceimpl

import static br.com.ghsistemas.principal.core.enuns.StatusDoRegistroEnum.EXCLUIDO;
import static br.com.ghsistemas.usuarios.utilitario.constantes.Constantes.ERRO_PESSOA_USUARIO_CHAVE;
import static br.com.ghsistemas.usuarios.utilitario.constantes.Constantes.PESSOA_USUARIO_MAIUSCULO;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.ghsistemas.principal.core.regras.ValidarIncluirAlterarExcluir;
import br.com.ghsistemas.principal.utilitario.mensagem.Mensagem;
import br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario;
import br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuarioService;
import br.com.ghsistemas.usuarios.core.pessoausuario.impl.regras.alterar.PessoaUsuarioRegraAlterar;
import br.com.ghsistemas.usuarios.core.pessoausuario.impl.regras.incluir.PessoaUsuarioRegraIncluir;
import br.com.ghsistemas.usuarios.core.pessoausuario.resource.PessoaUsuarioResource;

@Service
public class PessoaUsuarioServiceImpl extends PessoaUsuarioImpl implements PessoaUsuarioService {

    @Autowired
    private PessoaUsuarioRegraIncluir regraIncluir;
    @Autowired
    private ValidarIncluirAlterarExcluir validacaoId;

    @Override
    public void incluir(PessoaUsuarioResource resource, Collection<Mensagem> mensagens) {
        validacaoId.validarIncluir(resource.getId(), mensagens);
        validarMensagem(mensagens);
        regraIncluir.validarIncluir(resource, mensagens);
        validarMensagem(mensagens);
    }
}

Personal repository

package br.com.ghsistemas.usuarios.core.pessoausuario.impl;

import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import br.com.ghsistemas.usuarios.core.pessoa.Pessoa;
import br.com.ghsistemas.usuarios.core.pessoausuario.PessoaUsuario;
import br.com.ghsistemas.usuarios.core.usuario.Usuario;

@Repository
interface PessoaUsuarioRepository extends CrudRepository<PessoaUsuario, String> {

    PessoaUsuario findByByPessoaAndUsuario(Pessoa pessoa, Usuario usuario);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.