我得到以下错误消息,而运行我的项目
组织。springframework。豆。工厂UnsatisfiedPendencyException:创建名为“TipoeStatDoCivilController”的bean时出错:通过字段“TipoeStatDoCivilService”表示的未满足的依赖关系;嵌套的异常是org。springframework。豆。工厂UnsatisfiedPendencyException:创建名为“TipoeStatoCivilService”的bean时出错:通过字段“TipoeStatoCivilRepository”表示的未满足的依赖关系;嵌套的异常是org。springframework。豆。工厂BeanCreationException:创建名为“TipoeStatoCivilRepository”的bean时出错:调用init方法失败;嵌套的异常是org。springframework。数据映射。PropertyReferenceException:找不到TipoeStatoCivil类型的属性筛选器!
不幸的是,我找不到问题所在。
下面是与错误相关的主要类和接口
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
}
接口TipoEstado文明库
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);
}
界面查询
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);
}
Tipoestadocivillimpl类
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));
}
}
类TIPOESTADOCIVIALCONTROLLER
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;
}
}
错误消息
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.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@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'.
任何帮助的尝试都是受欢迎的。最好的问候。
类别提示
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);
}
}
我正在使用带有Boot的Spring Batch并使用XML配置来配置批处理作业。但是批处理作业是使用Tivoli调度的。同样,我希望通过使用批处理启动器进行配置来在本地运行。 我们怎样才能满足依赖性? 当我配置JobLauncher时 Database aseConfig.java XML配置:
我正在做项目的Spring启动...但是得到了这个错误,而运行应用程序。这可能是H2数据库错误。但是要解决这个错误localhost应该运行,但程序在部署前终止...所以我不能看到什么是实际问题。 错误:org.springframework.beans.factory.BeanCreationException:创建名称为'project TaskRepository'的bean时出错com.a
我有一个Spring启动应用程序。我用@Component注释了项目的一个类。现在在我的主类中,当我试图获取该类的bean时,我得到一个异常,它无法找到该bean。 注释为组件的类如下
2020-09-23T15:28:00.3483912Zjava.lang.IllegalStateExcture:未能加载Application ationContext 2020-09-23T15:28:00.3489821Z引起的原因:org.springframework.beans.factory.不满意依赖异常:创建在文件[/home/run/work/comation-service
为什么自动加载依赖项的注入失败。 严重:上下文初始化失败。springframework。豆。工厂BeanCreationException:创建名为“homeController”的bean时出错:自动连线依赖项的注入失败;嵌套的异常是org。springframework。豆。工厂BeanCreationException:无法自动关联字段:com。快速启动。通用域名格式。springmvc。
你好,我正在尝试按照本教程在我的项目中实现Spring Securityhttp://www.baeldung.com/2011/10/31/securing-a-restful-web-service-with-spring-security-3-1-part-3/#config,在运行我的程序时,我遇到了以下异常- org.springframework.beans.factory。BeanC