-1

私はSpring MVCが初めてです。私のコードは以前は機能していましたが、何かを変更したため、現在は失敗しています。残念ながら、何が悪いのか理解できません。これは私が得ているエラーです。何か案が?

public class Site {

    private String siteName;
    private String emailFromAddress;
    private String customerServicesEmailAddress;    
    private String googleAnalyticsAccountId;    
    private String doNotReplyEmailAddress;
    private String customerServicesTelephoneNumber;
    private String takeoverCss;
    private String helpUrl;
    private boolean isSubsite;
    private int searchResultsPerPage;
    private List<BlackWord> blackList;
    private List<QueryOverride> listOverrides; 
    ...
  }
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
    Field error in object 'site' on field 'listOverrides': rejected value [9]; codes [typeMismatch.site.listOverrides,typeMismatch.listOverrides,typeMismatch.java.util.List,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [site.listOverrides,listOverrides]; arguments []; default message [listOverrides]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.List' for property 'listOverrides'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.company.tabernus.commerce.domain.QueryOverride] for property 'listOverrides[0]': no matching editors or conversion strategy found]
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
        org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
        org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
        org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
        org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
4

1 に答える 1

1

最も役立つ行は次のとおりだと思います。

プロパティ 'listOverrides[0]' のタイプ [java.lang.String] の値を必要なタイプ [com.thehutgroup.tabernus.commerce.domain.QueryOverride] に変換できません: 一致するエディターまたは変換戦略が見つかりません

Spring は type の値をに入れようとしますがString、 aを alistOverridesに変換する方法を知りません。現在、問題を解決するために修正できる完全に間違ったことをしていない場合、Spring は文字列と QueryOverrides の間で変換する方法を知る必要があります (ほとんどの場合、双方向)。これについては、型コンバーターを調べることをお勧めします。StringQueryOverride

于 2013-10-08T14:46:03.913 に答える