欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

No converter found for return value of type: class XXX

程序员文章站 2024-01-14 12:02:40
...

今天使用springboot开发一个小demo,后端采用json返回数据,但是前端访问时出现错误.
前端错误如下:
No converter found for return value of type: class XXX
后端错误如下:

"D:\Program Files\Java\jdk1.8.0_152\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:51563,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\Administrator\.IntelliJIdea2019.2\system\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_152\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\rt.jar;D:\Workspace4Exercise\exercise\friday\target\classes;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-starter-thymeleaf\2.3.3.RELEASE\spring-boot-starter-thymeleaf-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-starter\2.3.3.RELEASE\spring-boot-starter-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot\2.3.3.RELEASE\spring-boot-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-autoconfigure\2.3.3.RELEASE\spring-boot-autoconfigure-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-starter-logging\2.3.3.RELEASE\spring-boot-starter-logging-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\apache-maven-3.5.2\repo\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\apache-maven-3.5.2\repo\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\apache-maven-3.5.2\repo\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\apache-maven-3.5.2\repo\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\apache-maven-3.5.2\repo\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\apache-maven-3.5.2\repo\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;D:\apache-maven-3.5.2\repo\org\thymeleaf\thymeleaf-spring5\3.0.11.RELEASE\thymeleaf-spring5-3.0.11.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\thymeleaf\thymeleaf\3.0.11.RELEASE\thymeleaf-3.0.11.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\attoparser\attoparser\2.0.5.RELEASE\attoparser-2.0.5.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\unbescape\unbescape\1.1.6.RELEASE\unbescape-1.1.6.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\apache-maven-3.5.2\repo\org\thymeleaf\extras\thymeleaf-extras-java8time\3.0.4.RELEASE\thymeleaf-extras-java8time-3.0.4.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-starter-web\2.3.3.RELEASE\spring-boot-starter-web-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-starter-json\2.3.3.RELEASE\spring-boot-starter-json-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\com\fasterxml\jackson\core\jackson-databind\2.11.2\jackson-databind-2.11.2.jar;D:\apache-maven-3.5.2\repo\com\fasterxml\jackson\core\jackson-annotations\2.11.2\jackson-annotations-2.11.2.jar;D:\apache-maven-3.5.2\repo\com\fasterxml\jackson\core\jackson-core\2.11.2\jackson-core-2.11.2.jar;D:\apache-maven-3.5.2\repo\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.2\jackson-datatype-jdk8-2.11.2.jar;D:\apache-maven-3.5.2\repo\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.2\jackson-datatype-jsr310-2.11.2.jar;D:\apache-maven-3.5.2\repo\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.2\jackson-module-parameter-names-2.11.2.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-starter-tomcat\2.3.3.RELEASE\spring-boot-starter-tomcat-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\apache\tomcat\embed\tomcat-embed-core\9.0.37\tomcat-embed-core-9.0.37.jar;D:\apache-maven-3.5.2\repo\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\apache-maven-3.5.2\repo\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.37\tomcat-embed-websocket-9.0.37.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-web\5.2.8.RELEASE\spring-web-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-beans\5.2.8.RELEASE\spring-beans-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-webmvc\5.2.8.RELEASE\spring-webmvc-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-aop\5.2.8.RELEASE\spring-aop-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-context\5.2.8.RELEASE\spring-context-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-expression\5.2.8.RELEASE\spring-expression-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.1.3\mybatis-spring-boot-starter-2.1.3.jar;D:\apache-maven-3.5.2\repo\org\springframework\boot\spring-boot-starter-jdbc\2.3.3.RELEASE\spring-boot-starter-jdbc-2.3.3.RELEASE.jar;D:\apache-maven-3.5.2\repo\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-jdbc\5.2.8.RELEASE\spring-jdbc-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-tx\5.2.8.RELEASE\spring-tx-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.1.3\mybatis-spring-boot-autoconfigure-2.1.3.jar;D:\apache-maven-3.5.2\repo\org\mybatis\mybatis\3.5.5\mybatis-3.5.5.jar;D:\apache-maven-3.5.2\repo\org\mybatis\mybatis-spring\2.0.5\mybatis-spring-2.0.5.jar;D:\apache-maven-3.5.2\repo\mysql\mysql-connector-java\8.0.21\mysql-connector-java-8.0.21.jar;D:\apache-maven-3.5.2\repo\com\alibaba\druid\1.1.10\druid-1.1.10.jar;D:\apache-maven-3.5.2\repo\org\projectlombok\lombok\1.18.12\lombok-1.18.12.jar;D:\apache-maven-3.5.2\repo\com\google\guava\guava\27.0-jre\guava-27.0-jre.jar;D:\apache-maven-3.5.2\repo\com\google\guava\failureaccess\1.0\failureaccess-1.0.jar;D:\apache-maven-3.5.2\repo\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\apache-maven-3.5.2\repo\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\apache-maven-3.5.2\repo\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;D:\apache-maven-3.5.2\repo\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;D:\apache-maven-3.5.2\repo\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;D:\apache-maven-3.5.2\repo\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-core\5.2.8.RELEASE\spring-core-5.2.8.RELEASE.jar;D:\apache-maven-3.5.2\repo\org\springframework\spring-jcl\5.2.8.RELEASE\spring-jcl-5.2.8.RELEASE.jar;D:\OpenSources\JetBrains\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar" com.xsh.friday.FridayApplication
Connected to the target VM, address: '127.0.0.1:51563', transport: 'socket'

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

2020-09-01 22:26:50.169  INFO 9124 --- [           main] com.xsh.friday.FridayApplication         : Starting FridayApplication on SAMSUNG with PID 9124 (D:\Workspace4Exercise\exercise\friday\target\classes started by Administrator in D:\Workspace4Exercise\exercise\friday)
2020-09-01 22:26:50.178  INFO 9124 --- [           main] com.xsh.friday.FridayApplication         : The following profiles are active: dev
2020-09-01 22:26:53.390  INFO 9124 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-09-01 22:26:53.406  INFO 9124 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-09-01 22:26:53.406  INFO 9124 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-09-01 22:26:53.570  INFO 9124 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-09-01 22:26:53.571  INFO 9124 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3092 ms
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.
2020-09-01 22:26:55.087  INFO 9124 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
2020-09-01 22:26:55.881  INFO 9124 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-09-01 22:26:56.007  INFO 9124 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page template: index
2020-09-01 22:26:56.334  INFO 9124 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-09-01 22:26:56.362  INFO 9124 --- [           main] com.xsh.friday.FridayApplication         : Started FridayApplication in 8.148 seconds (JVM running for 10.689)
2020-09-01 22:27:03.221  INFO 9124 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-09-01 22:27:03.221  INFO 9124 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-09-01 22:27:03.241  INFO 9124 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : Completed initialization in 19 ms
2020-09-01 22:27:03.711  WARN 9124 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class com.xsh.friday.base.result.Results]

是因为在Results类中没有getter/setter方法