2017-03-27 23 views
0

ich die folgende Fehlermeldung erhalten, während mein Projekt läuftorg.springframework.beans.factory.UnsatisfiedDependencyException: Fehler beim Erstellen der Bohne

org.springframework.beans.factory.UnsatisfiedDependencyException: Fehler Bean mit dem Namen ‚tipoEstadoCivilController‘ zu schaffen : Unzufriedene Abhängigkeit ausgedrückt durch Feld 'tipoEstadoCivilService'; Verschachtelte Ausnahme ist org.springframework.beans.factory.UnsatisfiedDependencyException: Fehler beim Erstellen einer Bean mit dem Namen 'tipoEstadoCivilService': Unzufriedene Abhängigkeit ausgedrückt durch Feld 'tipoEstadoCivilRepository'; Verschachtelte Ausnahme ist org.springframework.beans.factory.BeanCreationException: Fehler beim Erstellen von Bean mit dem Namen 'tipoEstadoCivilRepository': Aufruf der init-Methode fehlgeschlagen; verschachtelte Ausnahme ist org.springframework.data.mapping.PropertyReferenceException: Keine Eigenschaft filtrar gefunden für Typ TipoEstadoCivil!

Leider kann ich nicht finden, was falsch ist.

Hier sind meine wichtigsten Klassen und Schnittstellen zu dem Fehler im Zusammenhang

Klasse TipoEstadoCivil

package sgman.model; 

import org.hibernate.validator.constraints.NotBlank; 

import javax.persistence.*; 
import javax.validation.constraints.Size; 
import java.io.Serializable; 

@Entity 
@Table(name = "tipo_estado_civil") 
public class TipoEstadoCivil implements Serializable { 

    @Id 
    @GeneratedValue(strategy = GenerationType.IDENTITY) 
    @Column(name = "id_tipo_estado_civil", updatable = false, nullable = false) 
    private Long idTipoEstadoCivil; 

    @Column(name = "nome_estado_civil", nullable = false) 
    @NotBlank 
    @Size(min = 3, max = 32) 
    private String nomeEstadoCivil; 

    Getter and Setter 

    Equals and hashCode 
} 

Schnittstelle TipoEstadoCivilRepository

package sgman.repository; 

import sgman.model.TipoEstadoCivil; 
import sgman.repository.helper.TipoEstadoCivilQueries; 
import org.springframework.data.jpa.repository.JpaRepository; 
import org.springframework.stereotype.Repository; 

import java.util.Optional; 

@Repository 
public interface TipoEstadoCivilRepository extends JpaRepository<TipoEstadoCivil, Long>, TipoEstadoCivilQueries { 

    Optional<TipoEstadoCivil> findByNomeEstadoCivilIgnoreCase(String nomeEstadoCivil); 
} 

Schnittstelle TipoEstadoCivilQueries

package sgman.repository.helper; 

import sgman.model.TipoEstadoCivil; 
import sgman.repository.filter.TipoEstadoCivilFilter; 
import org.springframework.data.domain.Page; 
import org.springframework.data.domain.Pageable; 

public interface TipoEstadoCivilQueries { 

    Page<TipoEstadoCivil> filtrar(TipoEstadoCivilFilter filtro, Pageable pageable); 
} 

Klasse TipoEstadoCivilImpl

package sgman.repository.helper; 

import sgman.repository.filter.TipoEstadoCivilFilter; 
import sgman.model.TipoEstadoCivil; 
import sgman.repository.paginacao.PaginacaoUtil; 
import org.hibernate.Criteria; 
import org.hibernate.Session; 
import org.hibernate.criterion.MatchMode; 
import org.hibernate.criterion.Projections; 
import org.hibernate.criterion.Restrictions; 
import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.data.domain.Page; 
import org.springframework.data.domain.PageImpl; 
import org.springframework.data.domain.Pageable; 
import org.springframework.transaction.annotation.Transactional; 
import org.springframework.util.StringUtils; 

import javax.persistence.EntityManager; 
import javax.persistence.PersistenceContext; 

public class TipoEstadoCivilImpl implements TipoEstadoCivilQueries { 

    @PersistenceContext 
    private EntityManager manager; 

    @Autowired 
    private PaginacaoUtil paginacaoUtil; 

    private void addFilter(TipoEstadoCivilFilter tipoEstadoCivilFilter, Criteria criteria) { 
     if (tipoEstadoCivilFilter != null) { 
      if (!StringUtils.isEmpty(tipoEstadoCivilFilter.getNomeEstadoCivil())) { 
       criteria.add(Restrictions.ilike("nomeEstadoCivil", tipoEstadoCivilFilter.getNomeEstadoCivil(), MatchMode.ANYWHERE)); 
      } 
     } 
    } 

    private Long count(TipoEstadoCivilFilter tipoEstadoCivilFilter) { 
     Criteria criteria = manager.unwrap(Session.class).createCriteria(TipoEstadoCivil.class); 
     addFilter(tipoEstadoCivilFilter, criteria); 
     criteria.setProjection(Projections.rowCount()); 
     return (Long) criteria.uniqueResult(); 
    } 

    @SuppressWarnings("unchecked") 
    @Override 
    @Transactional(readOnly = true) 
    public Page<TipoEstadoCivil> filtrar(TipoEstadoCivilFilter tipoEstadoCivilFilter, Pageable pageable) { 
     Criteria criteria = manager.unwrap(Session.class).createCriteria(TipoEstadoCivil.class); 
     paginacaoUtil.preparar(criteria, pageable); 
     addFilter(tipoEstadoCivilFilter, criteria); 
     return new PageImpl<>(criteria.list(), pageable, count(tipoEstadoCivilFilter)); 
    } 
} 

Klasse TipoEstadoCivilController

package sgman.controller; 

import sgman.controller.page.PageWrapper; 
import sgman.exception.TipoEstadoCivilAlreadyExists; 
import sgman.model.TipoEstadoCivil; 
import sgman.repository.TipoEstadoCivilRepository; 
import sgman.repository.filter.TipoEstadoCivilFilter; 
import sgman.service.TipoEstadoCivilService; 
import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.data.domain.Pageable; 
import org.springframework.data.web.PageableDefault; 
import org.springframework.http.MediaType; 
import org.springframework.http.ResponseEntity; 
import org.springframework.stereotype.Controller; 
import org.springframework.validation.BindingResult; 
import org.springframework.web.bind.annotation.*; 
import org.springframework.web.servlet.ModelAndView; 
import org.springframework.web.servlet.mvc.support.RedirectAttributes; 

import javax.servlet.http.HttpServletRequest; 
import javax.validation.Valid; 

@Controller 
@RequestMapping("/tipoEstadoCivil") 
public class TipoEstadoCivilController { 

    @Autowired 
    private TipoEstadoCivilService tipoEstadoCivilService; 

    @Autowired 
    private TipoEstadoCivilRepository tipoEstadoCivilRepository; 

    @RequestMapping("/novo") 
    public ModelAndView novo(TipoEstadoCivil tipoEstadoCivil) { 
     return new ModelAndView("tipoEstadoCivil/novoEstadoCivil"); 
    } 

    @RequestMapping(value = "/novo", method = RequestMethod.POST) 
    public ModelAndView cadastrar(@Valid TipoEstadoCivil tipoEstadoCivil, BindingResult result, RedirectAttributes attributes) { 
     if (result.hasErrors()) { 
      return novo(tipoEstadoCivil); 
     } 
     try { 
      tipoEstadoCivilService.saveTipoEstadoCivil(tipoEstadoCivil); 
     } catch (TipoEstadoCivilAlreadyExists e) { 
      result.rejectValue("nomeEstadoCivil", e.getMessage(), e.getMessage()); 
      return novo(tipoEstadoCivil); 
     } 
     attributes.addFlashAttribute("mensagem", "Estado civil salvo com sucesso"); 
     return new ModelAndView("redirect:/tipoEstadoCivil/novo"); 
    } 

    @RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }) 
    public @ResponseBody ResponseEntity<?> salvar(@RequestBody @Valid TipoEstadoCivil tipoEstadoCivil, BindingResult result) { 
     if (result.hasErrors()) { 
      return ResponseEntity.badRequest().body(result.getFieldError("nomeEstadoCivil").getDefaultMessage()); 
     } 
     tipoEstadoCivil = tipoEstadoCivilService.saveTipoEstadoCivil(tipoEstadoCivil); 
     return ResponseEntity.ok(tipoEstadoCivil); 
    } 

    @GetMapping 
    public ModelAndView pesquisar(TipoEstadoCivilFilter estiloFilter, BindingResult result, @PageableDefault(size = 2) Pageable pageable, HttpServletRequest httpServletRequest) { 
     ModelAndView mv = new ModelAndView("estilo/PesquisaEstilos"); 
     PageWrapper<TipoEstadoCivil> paginaWrapper = new PageWrapper<>(tipoEstadoCivilRepository.filtrar(estiloFilter, pageable), httpServletRequest); 
     mv.addObject("pagina", paginaWrapper); 
     return mv; 
    } 
} 

Fehlermeldung

19:41:39: Executing external task 'bootRun'... 
:compileJava UP-TO-DATE 
:processResources 
:classes 
:findMainClass 
:bootRun 

    . ____   _   __ _ _ 
/\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 
(()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
\\/ ___)| |_)| | | | | || (_| | )))) 
    ' |____| .__|_| |_|_| |_\__, |//// 
=========|_|==============|___/=/_/_/_/ 
:: Spring Boot ::  (v1.5.2.RELEASE) 

2017-03-27 19:41:49.559 INFO 3680 --- [   main] sgman.SgmanApplication  : Starting SgmanApplication on nbcatsis11 with PID 3680 (D:\projetos\sgman\build\classes\main started by ss801559 in D:\projetos\sgman) 
2017-03-27 19:41:49.575 INFO 3680 --- [   main] sgman.SgmanApplication  : No active profile set, falling back to default profiles: default 
2017-03-27 19:41:50.068 INFO 3680 --- [   main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]29ba4338: startup date [Mon Mar 27 19:41:50 BRT 2017]; root of context hierarchy 
2017-03-27 19:41:51.246 INFO 3680 --- [   main] o.s.b.f.s.DefaultListableBeanFactory  : Overriding bean definition for bean 'dataSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]] 
2017-03-27 19:41:52.091 INFO 3680 --- [   main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$6fc2d68c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2017-03-27 19:41:52.901 INFO 3680 --- [   main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 
2017-03-27 19:41:52.917 INFO 3680 --- [   main] o.apache.catalina.core.StandardService : Starting service Tomcat 
2017-03-27 19:41:52.917 INFO 3680 --- [   main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.11 
2017-03-27 19:41:53.196 INFO 3680 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]  : Initializing Spring embedded WebApplicationContext 
2017-03-27 19:41:53.197 INFO 3680 --- [ost-startStop-1] o.s.web.context.ContextLoader   : Root WebApplicationContext: initialization completed in 3134 ms 
2017-03-27 19:41:53.444 INFO 3680 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 
2017-03-27 19:41:53.451 INFO 3680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 
2017-03-27 19:41:53.452 INFO 3680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 
2017-03-27 19:41:53.452 INFO 3680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 
2017-03-27 19:41:53.452 INFO 3680 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 
2017-03-27 19:41:54.283 INFO 3680 --- [   main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 
2017-03-27 19:41:54.299 INFO 3680 --- [   main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ 
    name: default 
    ...] 
2017-03-27 19:41:54.539 INFO 3680 --- [   main] org.hibernate.Version     : HHH000412: Hibernate Core {5.0.12.Final} 
2017-03-27 19:41:54.539 INFO 3680 --- [   main] org.hibernate.cfg.Environment   : HHH000206: hibernate.properties not found 
2017-03-27 19:41:54.539 INFO 3680 --- [   main] org.hibernate.cfg.Environment   : HHH000021: Bytecode provider name : javassist 
2017-03-27 19:41:54.586 INFO 3680 --- [   main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 
2017-03-27 19:41:54.680 INFO 3680 --- [   main] org.hibernate.dialect.Dialect   : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 
2017-03-27 19:41:55.378 INFO 3680 --- [   main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update 
2017-03-27 19:41:55.483 INFO 3680 --- [   main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 
2017-03-27 19:41:55.813 WARN 3680 --- [   main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tipoEstadoCivilController': Unsatisfied dependency expressed through field 'tipoEstadoCivilService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tipoEstadoCivilService': Unsatisfied dependency expressed through field 'tipoEstadoCivilRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tipoEstadoCivilRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property filtrar found for type TipoEstadoCivil! 
2017-03-27 19:41:55.813 INFO 3680 --- [   main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 
2017-03-27 19:41:55.813 INFO 3680 --- [   main] o.apache.catalina.core.StandardService : Stopping service Tomcat 
2017-03-27 19:41:55.828 INFO 3680 --- [   main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 
2017-03-27 19:41:55.844 ERROR 3680 --- [   main] o.s.boot.SpringApplication    : Application startup failed 

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tipoEstadoCivilController': Unsatisfied dependency expressed through field 'tipoEstadoCivilService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tipoEstadoCivilService': Unsatisfied dependency expressed through field 'tipoEstadoCivilRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tipoEstadoCivilRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property filtrar found for type TipoEstadoCivil! 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] 
    at sgman.SgmanApplication.main(SgmanApplication.java:10) [main/:na] 
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tipoEstadoCivilService': Unsatisfied dependency expressed through field 'tipoEstadoCivilRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tipoEstadoCivilRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property filtrar found for type TipoEstadoCivil! 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    ... 19 common frames omitted 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tipoEstadoCivilRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property filtrar found for type TipoEstadoCivil! 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    ... 32 common frames omitted 
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property filtrar found for type TipoEstadoCivil! 
    at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:77) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:329) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:309) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:272) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:243) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.query.parser.Part.<init>(Part.java:76) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:247) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:398) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:378) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:86) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:64) ~[spring-data-jpa-1.11.1.RELEASE.jar:na] 
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:103) ~[spring-data-jpa-1.11.1.RELEASE.jar:na] 
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:214) ~[spring-data-jpa-1.11.1.RELEASE.jar:na] 
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77) ~[spring-data-jpa-1.11.1.RELEASE.jar:na] 
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:436) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:221) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263) ~[spring-data-commons-1.13.1.RELEASE.jar:na] 
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:101) ~[spring-data-jpa-1.11.1.RELEASE.jar:na] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] 
    ... 42 common frames omitted 

:bootRun FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':bootRun'. 
> Process 'command 'C:\Program Files\Java\jdk1.8.0_112\bin\java.exe'' finished with non-zero exit value 1 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 16.662 secs 
Process 'command 'C:\Program Files\Java\jdk1.8.0_112\bin\java.exe'' finished with non-zero exit value 1 
19:41:56: External task execution finished 'bootRun'. 

Jeder Versuch zu helfen, ist zu begrüßen. Mit freundlichen Grüßen.

+0

Sie den Code für TipoEstadoCivilService hinzufügen können? – jmw5598

+0

Spring versucht, eine Abfrage für den Filter basierend auf Namen zu erstellen und dies nicht zu tun. Ich bin mir nicht sicher, wie ich Spring davon abhalten kann. – johncena

+0

Ja, ich kann. Entschuldigung für meine Vergesslichkeit. Danke –

Antwort

0

Klasse TipoEstadoCivilService

package sgman.service; 

import sgman.exception.TipoEstadoCivilAlreadyExists; 
import sgman.model.TipoEstadoCivil; 
import sgman.repository.TipoEstadoCivilRepository; 
import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.stereotype.Service; 

import javax.transaction.Transactional; 
import java.util.Optional; 

@Service 
public class TipoEstadoCivilService { 

    @Autowired 
    private TipoEstadoCivilRepository tipoEstadoCivilRepository; 

    @Transactional 
    public TipoEstadoCivil saveTipoEstadoCivil(TipoEstadoCivil tipoEstadoCivil) { 
     Optional<TipoEstadoCivil> tipoEstadoCivilOptional = tipoEstadoCivilRepository.findByNomeEstadoCivilIgnoreCase(tipoEstadoCivil.getNomeEstadoCivil()); 
     if (tipoEstadoCivilOptional.isPresent()) { 
      throw new TipoEstadoCivilAlreadyExists("Estado civil já cadastrado"); 
     } 
     return tipoEstadoCivilRepository.saveAndFlush(tipoEstadoCivil); 
    } 
} 
Verwandte Themen