[英]No property date found for type cashflow in Springboot app
我正在使用实体、存储库、服务、控制器设计模式编写关于现金流实体的休息服务。
实体:-
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import org.hibernate.annotations.NaturalId;
@Entity
@Table(name = "cashflow")
public class Cashflow implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NaturalId
@NotBlank
private String entityId;
@Column(nullable = false)
private String companyId;
@Column
private boolean isDeleted = true;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEntityId() {
return entityId;
}
public void setEntityId(String entityId) {
this.entityId = entityId;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public boolean isDeleted() {
return isDeleted;
}
public void setDeleted(boolean isDeleted) {
this.isDeleted = isDeleted;
}
}
存储库:-
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CashflowRepository extends PagingAndSortingRepository<Cashflow, Long> {
Page<Cashflow> findAllByCompanyIdAndIsDeleted(String companyId, boolean flag, Pageable pageable);
public Cashflow findByEntityId(String entityId);
public List<Cashflow> findAllByEntityIdIn(List<String> entityIds);
}
服务:-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
@Service
public class CashflowService {
@Autowired
private CashflowRepository cashflowRepository;
public Page<Cashflow> findByCompanyId(String companyId, Integer pageNo, Integer pageSize, String sortBy) {
Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy));
Page<Cashflow> pagedResult = cashflowRepository.findAllByCompanyIdAndIsDeleted(companyId, false, paging);
return pagedResult;
}
}
控制器:-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin
@RestController
public class CashflowController {
@Autowired
private CashflowService cashflowService;
@GetMapping(value = "/{companyId}/settlement/cashflows")
public Page<Cashflow> findParcels(@PathVariable("companyId") String companyId, @RequestParam(defaultValue = "0") Integer pageNo, @RequestParam(defaultValue = "10") Integer pageSize, @RequestParam(defaultValue = "date") String sortBy) {
return cashflowService.findByCompanyId(companyId, pageNo, pageSize, sortBy);
}
}
当我调用该服务时,出现以下错误:-
org.springframework.data.mapping.PropertyReferenceException:找不到现金流类型的属性日期! 在 org.springframework.data.mapping.PropertyPath.(PropertyPath.java:94) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.mapping.PropertyPath .create(PropertyPath.java:382) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:358) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:311) ~[spring-data- commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na] 在 org.springframework.data。 mapping.PropertyPath.from(PropertyPath.java:293) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.mapping.PropertyPath.from(PropertyPath.java :276) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.QueryUtils.toJpaOrder(QueryUtils.java:565) ~[春大 ta-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.QueryUtils.toOrders(QueryUtils.java:518) ~[spring-data-jpa-2.1 .9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:197) ~[spring-data-jpa-2.1.9.RELEASE. jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:150) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9 .RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:57) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org .springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:95) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data。 jpa.repository.query.PartTreeJpaQuery$QueryPreparer.createQuery(PartTreeJpaQuery.java:164) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data .jpa.repository.query.PartTreeJpaQuery.doCreateQuery(PartTreeJpaQuery.java:94) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository。 query.AbstractJpaQuery.createQuery(AbstractJpaQuery.java:210) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryExecution$PagedExecution .doExecute(JpaQueryExecution.java:199) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution. java:91) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:136) ~ [spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:125) ~[spring-data- jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryEx ecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:605) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor. $invoke$3(RepositoryFactorySupport.java:595) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke (RepositoryFactorySupport.java:595) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[ spring-aop-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59) ~[spring-data-commons-2.1.9.RELEASE .jar:2.1.9.RELEASE] 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spri ng-aop-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) ~[spring-tx-5.1.8.RELEASE.jar :5.1.8.RELEASE] 在 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework .aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor) java:139) ~[spring-tx-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1 .8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(C rudMethodMetadataPostProcessor.java:138) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring -aop-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) ~[spring-aop-5.1.8.RELEASE.jar: 5.1.8.RELEASE] 在 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework。 data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation .proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkD ynamicAopProxy.java:212) ~[spring-aop-5.1.8.RELEASE.jar:5.1.8.RELEASE] at com.sun.proxy.$Proxy234.findAllByCompanyIdAndIsDeleted(Unknown Source) ~[na:na] at com. cstar.api.settlement.CashflowService.findByCompanyId(CashflowService.java:18) ~[main/:na] 在 com.cstar.api.settlement.CashflowController.findParcels(CashflowController.java:20) ~[main/:na] 在java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] 在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]在 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] 在 java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[ na:na] 在 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework。 web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java :138) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[ spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1 .8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.8.RELEASE. jar:5.1.8.RELEASE] 在 org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE ] 在 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.servlet.DispatcherServlet .doService (DispatcherServlet.java:942) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring- webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1 .8.RELEASE] 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.springframework.web.servlet.FrameworkServlet .service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat- embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.21.jar:9.0.21 ] 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.tomcat.websocket .server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar :9.0.21] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.apache.catalina .core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88) ~[spring-boot-actuator -2.1.6.RELEASE.jar:2.1.6.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter.doFi lter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat -embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0。 21] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework。 security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.access .intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:334) ~[spring-security-we b-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.1.5.RELEASE .jar:5.1.5.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5。 RELEASE] 在 org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework。 security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.authentication.AnonymousAuthenticationFilter .doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: [334] 334) security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.1.5 .RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1。 5.RELEASE] 在 org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org. springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 com.cstar.api.config.JwtRequestFilter .doFilterInternal(JwtRequestFilter.java:75) ~[main/:na] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1 .8.RELEASE] 在 org.springframewo rk.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.authentication .logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter( FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) ~[spring -web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar: 5.1.8.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:7 4) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1 .8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar: 5.1.5.RELEASE] 在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web .context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter。 doFilter(OncePerRequestFilter.j ava:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security -web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在 org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.1.5.RELEASE。 jar:5.1.5.RELEASE] 在 org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.1.5.RELEASE.jar:5.1.5.RELEASE] 在org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:270) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat- embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.doF 过滤器(ApplicationFilterChain.java:166)~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web -5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1。 8.RELEASE] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core。 ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21] at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring -web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar: 5.1.8.RELEASE] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio nFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core -9.0.21.jar:9.0.21] 在 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.apache.catalina.core.ApplicationFilterChain。 internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed -core-9.0.21.jar:9.0.21] 在 org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114) ~[spring-boot-actuator-2.1.6. RELEASE.jar:2.1.6.RELEASE] 在 org.springframework.boot.actuate.metrics.web.servlet。 WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104) ~[spring-boot-actuator-2.1.6.RELEASE.jar:2.1.6.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109 ) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0. 21.jar:9.0.21] 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.springframework。 web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java :109) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core- 9.0.21.jar:9.0.21] 在 org.apache.catalina.core。 ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.21.jar:9.0.21] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat -embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.21.jar:9.0。 21] 在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.StandardHostValve。 invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.21.jar:9.0.21] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed -core-9.0.21.jar:9.0.21] 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.21.jar:9.0.21]在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.coyote.http11.Http11Pr ocessor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed -core-9.0.21.jar:9.0.21] 在 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) ~[tomcat-embed-core-9.0.21.jar:9.0.21]在 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 org.apache.tomcat.util。 net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ) ~[na:na] 在 java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] 在 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable .run(TaskThread.java:61) ~[tomcat-embed-core-9.0.21.jar:9.0.21] 在 java.base/java.lang.Thread.run(Thread.java:835) ~[na:呐]
我已经基于相同的设计模式构建了 REST api,它对我来说效果很好。 我不明白,为什么它说“没有找到现金流类型的财产日期!”? 无论如何,实体中没有日期属性。 我尝试删除数据库并重新开始,没有用。 我错过了什么?
stracktrace 告诉你问题是什么
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:293) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] at
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:276) ~[spring-data-commons-2.1.9.RELEASE.jar:2.1.9.RELEASE] at
org.springframework.data.jpa.repository.query.QueryUtils.toJpaOrder(QueryUtils.java:565) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] at
org.springframework.data.jpa.repository.query.QueryUtils.toOrders(QueryUtils.java:518) ~[spring-data-jpa-2.1.9.RELEASE.jar:2.1.9.RELEASE] at
这清楚地表明,在生成排序子句时,它会在未知属性上中断。 排序是根据您在控制器中构造的传入Pageable
完成的。 该构造取决于传入的请求参数sortBy
,该参数的默认值为date
。
现在,当参数不存在时,将使用此值,因为您的实体没有date
属性,它会中断。
删除排序或提供有效的默认值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.