spring boot项目接口返回json数据报错,怎么解决啊! 20C

ajax调用了一个接口,返回时页面报错.
图片说明

但是直接用网页访问接口时就没问题
图片说明

求大神指点一下啊 这是什么情况啊.

数据少的时候就没有问题,数据多了才会报错

2个回答

返回的数据类型不是json数据,你仔细看你直接请求的数据,<String xmln .....

z429249928
z429249928 但是数据量不是很大的时候就没有问题
6 天之前 回复

看你ajax请求的接口返回数据是不是json,不是加上@ResponseBody

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

求助 创建spring boot项目时,IDE自身报错

1.错误介绍: 今天突然出现 My Eclipse 2017 创建spring boot项目时 IDE自身报错,提示json文件缺少开头或结尾。 2.错误详细过程: 于IDE创建spring boot项目, new —— Spring Starter Project 后 弹框报错。(点击后即IDE自身弹框报错,并非创建项目后 项目报错) 3.卸载后清理注册表重装IDE无效,且百度无果,特来请教各位大牛 ![图片说明](https://img-ask.csdn.net/upload/201905/22/1558537270_433839.png)

spring boot返回json数据,在html通过ajax请求不能获取数据

1.这是我的controller代码 ``` @RestController public class ComputeController { private final Logger logger = Logger.getLogger(getClass()); @RequestMapping(value = "/test", method = RequestMethod.GET) public List<String> test() { ServiceInstance instance = client.getLocalServiceInstance(); List<String> list = new ArrayList<>(); list.add("hello"); list.add("world"); logger.info("/test test" + instance.getHost() + ",service_id:" + instance.getServiceId() + ",result:" + list.toString()); return list; } } ``` 2.这里是我的html ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>INDEX</title> <script src="jquery-1.8.0.min.js"></script> <script> $(document).ready(function () { $("#btn").click(function () { alert("start"); $.get("http://localhost:4444/add?a=12&b=3", function (data) { $("div").html(data); }); alert("end"); }); }); </script> </head> <body> <h2>INDEX</h2> <button id="btn">ajax</button> <div id="div"></div> </body> </html> ``` 问题:在jquery中,alert("start")和alert("end")都会正常执行,但是ajax的回调函数不能正常执行。

创建springboot项目后报错!!

尝试使用springboot框架 下载IDE后 创建项目pom.xml报错 百度好多解决不了问题 有没有大神知道的![![![图片说明](https://img-ask.csdn.net/upload/201803/01/1519886501_206571.png)图片说明](https://img-ask.csdn.net/upload/201803/01/1519886491_549406.png)图片说明](https://img-ask.csdn.net/upload/201803/01/1519886481_160487.png)

spring boot 项目访问controller报错

搭建最基本的spring boot项目,版本是2.0.4.RELEASE。 整合mybatis, 从数据库中查询数据。 我想 通过浏览器,直接访问controller,看到json格式的数据; 但是,控制台中能看到查询的数据,接下来就报错。 Controller ``` @Controller public class UserController { @Autowired private UserService userService; @GetMapping("/findAll") @ResponseBody public List<User> findAll(){ List<User> list = userService.findAll(); System.out.println(Arrays.toString(list.toArray())); return userService.findAll(); } } ``` 访问 http://localhost:1111/findAll ![浏览器端没有显示json格式数据](https://img-ask.csdn.net/upload/201808/21/1534843529_294415.png) 控制台先显示查询出来的数据,然后报错; ``` [User{id='122221', status='1', roleId='03bd3cc782b242bbab08c464ac35b0fa', remark='监控大盘', UpdateTime=2018-08-16 15:10:27.0}, User{id='12222221', status='1', roleId='03bd3cc782b242bbab08c464ac35b0fa', remark='监控大盘', UpdateTime=2018-08-16 15:10:27.0}, User{id='yyx', status='1', roleId='yyx0101', remark='监控大盘', UpdateTime=2018-08-16 15:10:27.0}] 2018-08-21 17:03:55.089 INFO 17728 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 410ms 2018-08-21 17:03:55.132 ERROR 17728 --- [nio-1111-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/module/jaxb/JaxbAnnotationIntrospector] with root cause java.lang.ClassNotFoundException: com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector ``` 按照之前的想法,加上了@ResponseBody 注解后,方法返回的数据应该被springboot内置的jackson,转换成了json格式的数据, 然后浏览器端直接显示的。 不知道问题出在哪里?

spring boot创建错误,Error parsing JSON response

创建spring boot的 报错,查了半天没有解决办法,求解 ![图片说明](https://img-ask.csdn.net/upload/202006/01/1591006843_956887.png) ## 刚刚一个大佬回复我了,问题解决了555555 ![图片说明](https://img-ask.csdn.net/upload/202006/01/1591007686_473501.png) ## 我也不了解为啥进阿里云的就可以了,我之前都是去springboot里的,压根就没往这方面想,算了,总算是解决了哈哈哈,问题先留在这吧,等学完了springboot我再回来研究研究。 ## 感谢[大佬](https://blog.csdn.net/weixin_43981190/article/details/105051422#comments_12415429 "") ##

spring boot表单同时上传文件和json

<form> <input name=filename type="file"> <input type="text" > <form> @PostMapping("vlues") public void addBlackList(HttpServletRequest request, HttpServletResponse response, @RequestParam("filename") MultipartFile file) throws IOException {......} 如上;表单接收一个文件或者文本,文本以JSON的格式POST上传,文件和文本都可以不传其中一个。后台代码怎么写才可以实现文件不传???直接用springboot的MultipartFile,不传文件会报错。救救孩子!!!

spring boot 整合kafka报错怎么解决?

整合了一下spring boot跟kafka老是一直报错 ``` 2018-05-20 18:56:26.920 ERROR 4428 --- [ main] o.s.k.support.LoggingProducerListener : Exception thrown when sending a message with key='null' and payload='myTest--------1' to topic myTest: org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms. ``` 请问一下各位大佬怎么解决的? 相应代码如下,也是参考了网上的: ``` <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> </dependency> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version>0.10.2.0</version> </dependency> ``` kafka版本及配置 kafka_2.11-1.1.0 配置: ``` port = 9092 host.name = 阿里内网ip advertised.host.name = xxx.xxx.xx 阿里外网ip ``` 其他配置默认了 然后spring boot配置 ``` kafka: bootstrap-servers: xxx.xxx.xxx.xxx:9092 listener.concurrency: 3 producer.batch-size: 1000 consumer.group-id: test-consumer-group ``` ``` ``` @Configuration @EnableKafka public class KafkaConfiguration { } ``` @Component public class MsgProducer { private Logger log = LoggerFactory.getLogger(MsgProducer.class); @Autowired private KafkaTemplate<String, String> kafkaTemplate; public void sendMessage(String topicName, String jsonData) { log.info("向kafka推送数据:[{}]", jsonData); try { kafkaTemplate.send(topicName, jsonData); } catch (Exception e) { System.out.println("发送数据出错!!!"+topicName+","+jsonData); System.out.println("发送数据出错=====>"+e); log.error("发送数据出错!!!{}{}", topicName, jsonData); log.error("发送数据出错=====>", e); } //消息发送的监听器,用于回调返回信息 kafkaTemplate.setProducerListener(new ProducerListener<String, String>() { @Override public void onSuccess(String topic, Integer partition, String key, String value, RecordMetadata recordMetadata) { System.out.println("topic-----"+topic); } @Override public void onError(String topic, Integer partition, String key, String value, Exception exception) { } @Override public boolean isInterestedInSuccess() { log.info("数据发送完毕"); System.out.println("数据发送完毕"); return false; } }); } } @Component public class MsgConsumer { @KafkaListener(topics = {"myTest"}) public void processMessage(String content) { System.out.println("消息被消费"+content); } } @RunWith(SpringRunner.class) @SpringBootTest public class TestKafka { @Autowired private MsgProducer msgProducer; @Test public void test() throws Exception { msgProducer.sendMessage("myTest", "myTest--------1"); } } ``` 就是这样;运行test老是一直这个错误

Spring Tool Suite创建Spring Boot项目总是失败,难道你们都是一步成功的吗?

前段时间用STS成功创建过Spring Boot项目,今天又回头来跟着 Mastering Spring MVC 4这本书做些例子 总是报这个错 ,![图片说明](https://img-ask.csdn.net/upload/201712/05/1512485503_812783.png)

json数组问题,springboot怎么拿到json数组中含有数组的格式

刚开始看springboot,按照原码: ``` public ArrayList<Rainweek> test2() { Connection conn = null; PreparedStatement preparedStatement = null; ResultSet rs = null; ArrayList<Rainweek> RainweekArrayList = new ArrayList<>(); Rainweek rainweek = null; DataSource ds = applicationConfig.getDataSource(); try { conn = ds.getConnection(); preparedStatement = conn.prepareStatement("sqlyuju"); rs = preparedStatement.executeQuery(); while(rs.next()) { rainweek = new Rainweek(); rainweek.setSenid(rs.getBigDecimal("senid")); rainweek.setTime(rs.getString("time")); rainweek.setV(rs.getBigDecimal("v")); RainweekArrayList.add(rainweek); } } catch (Exception e) { e.printStackTrace(); } finally { try { if(null != rs) rs.close(); if(null != preparedStatement) preparedStatement.close(); if(null != conn) conn.close(); } catch (Exception e) { e.printStackTrace(); } } return RainweekArrayList; } ``` 可拿到类似[{id:1,name:xx},{is:2,name:xx}] 但是现在需要拿到多个数据,类似这种: ![图片说明](https://img-ask.csdn.net/upload/201904/08/1554723741_378219.jpg) 小白,请问该怎么写?

Spring Boot 前后端交互遇到问题

前端我使用Ajax传送json数据,后端我用springboot框架来接受数据,但是现在遇到一个比较 头疼的问题: 前端代码: function formtojson(){ var jstr=$('form').serializeArray(); var str = JSON.stringify(jstr); alert(str); $.ajax({ type:"post", contentType: "application/json;charset=UTF-8;", dataType:'json', url:"http://localhost:8080/Maven1/getall", data: {"params":str}, success:function (data) { alert(data);} }) } 后端代码: @RequestMapping(value="/getall") @ResponseBody void test(HttpServletRequest request){ String json = request.getParameter("params"); System.out.println("json"); } } 前后端开发是分离开的,我单独写了html文件来向后端传送数据,但是奇怪的是我单独用我自己写的html页面去向我的后端传送数据的时候报错: 2019-06-16 12:31:43.019 WARN 2404 --- [nio-8080-exec-8] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/Maven1/getall] in DispatcherServlet with name 'dispatcherServlet' 但是我自己在eclipise中跑然后直接在浏览器里访问 "lochost:8080/getall"却可以打印出来json。 目前自己还是小白一枚,这个问题困扰许久,代码可能有点问题,但是奈何自己找了好多办法都没搞定,希望各位赐教。不胜感激!

Spring boot controller类加入@Autowired注解启动报错

![图片说明](https://img-ask.csdn.net/upload/201904/11/1554974904_886024.png) 工程结构 ``` //下面是全部的代码,最下面时错误日志。第一次提问,不知道插入代码片的格式是不是这样的,跪求大神指导,已经看了很多解决方案,但都无法解决我的问题,注释掉Autowired或者@注释掉Autowired(required=false)虽然可以启动项目,但是程序执行时又会发生错误,问题是逃避不了的。再次跪求大神指导。 //controller package controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import bean.AppMessage; import service.AppMessageService; @RestController @RequestMapping("/appmessage") public class AppMessageController { @Autowired/*(required=false)*/ private AppMessageService service; @RequestMapping("/getThree") public List<AppMessage> getThreeForMessage(){ List<AppMessage> list = service.getMessage(); return list; } @RequestMapping("/getAll") public List<AppMessage> getAllMessage(){ List<AppMessage> list = service.getAllMessage(); int num = list.size(); if(null!=list && num>3){ for (int i = 0; i < num-3; i++) { list.remove(0); } } return list; } @RequestMapping("/getByID") public List<AppMessage> getMessageById(@RequestParam("id") String id){ List<AppMessage> list = service.getMessageById(id); int num = list.size(); if(null!=list && num>5){ for (int i = 0; i < num-5; i++) { list.remove(0); } } return list; } @RequestMapping(value = "/add",method = RequestMethod.POST) public int addMessage(@RequestBody AppMessage appMessage){ return service.addMessage(appMessage); } @RequestMapping(value="/delMessageById",method=RequestMethod.POST) public int delMessageById(@RequestParam("id") String id){ return service.delMessage(id); } } ``` ``` //Service package service; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import bean.AppMessage; import mapper.AppMessageMapper; @Transactional @Service("appMessageService") public class AppMessageService { @Autowired private AppMessageMapper mapper; public List<AppMessage> getMessage(){ List<AppMessage> list = new ArrayList<AppMessage>(); list.add(mapper.selectByPrimaryKey("xtt")); //list = mapper.selectAll(); return list; } public List<AppMessage> getAllMessage(){ List<AppMessage> list = new ArrayList<AppMessage>(); list = mapper.selectAll(); return list; } public int addMessage(AppMessage appMessage) { return mapper.insert(appMessage); } public List<AppMessage> getMessageById(String id) { return mapper.getMessById(id); } public int delMessage(String id) { return mapper.deleteByPrimaryKey(id); } } ``` ``` //Mapper 接口,映射到mapper.xml package mapper; import java.util.List; import bean.AppMessage; public interface AppMessageMapper { int deleteByPrimaryKey(String id); int insert(AppMessage record); int insertSelective(AppMessage record); AppMessage selectByPrimaryKey(String id); int updateByPrimaryKeySelective(AppMessage record); int updateByPrimaryKey(AppMessage record); List<AppMessage> selectAll(); List<AppMessage> getMessById(String id); } ``` ``` <!-- Mapper.xml文件 --> <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="mapper.AppMessageMapper" > <!-- 对应mapper接口的位置 --> <resultMap id="BaseResultMap" type="bean.AppMessage" > <id column="id" property="id" jdbcType="VARCHAR" /> <result column="message" property="message" jdbcType="VARCHAR" /> <result column="senddate" property="senddate" jdbcType="TIMESTAMP" /> </resultMap> <sql id="Base_Column_List" > id, message, senddate </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > select <include refid="Base_Column_List" /> from appuser_message where id = #{id,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > delete from appuser_message where id = #{id,jdbcType=VARCHAR} </delete> <insert id="insert" parameterType="bean.AppMessage" > insert into appuser_message (id, message, senddate ) values (#{id,jdbcType=VARCHAR}, #{message,jdbcType=VARCHAR}, #{senddate,jdbcType=TIMESTAMP} ) </insert> <insert id="insertSelective" parameterType="bean.AppMessage" > insert into appuser_message <trim prefix="(" suffix=")" suffixOverrides="," > <if test="id != null" > id, </if> <if test="message != null" > message, </if> <if test="senddate != null" > senddate, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="id != null" > #{id,jdbcType=VARCHAR}, </if> <if test="message != null" > #{message,jdbcType=VARCHAR}, </if> <if test="senddate != null" > #{senddate,jdbcType=TIMESTAMP}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="bean.AppMessage" > update appuser_message <set > <if test="message != null" > message = #{message,jdbcType=VARCHAR}, </if> <if test="senddate != null" > senddate = #{senddate,jdbcType=TIMESTAMP}, </if> </set> where id = #{id,jdbcType=VARCHAR} </update> <update id="updateByPrimaryKey" parameterType="bean.AppMessage" > update appuser_message set message = #{message,jdbcType=VARCHAR}, senddate = #{senddate,jdbcType=TIMESTAMP} where id = #{id,jdbcType=VARCHAR} </update> <select id="selectAll" resultMap="BaseResultMap"> select id, message, senddate from appuser_message order by senddate </select> <select id="getMessById" resultMap="BaseResultMap" parameterType="java.lang.String"> select id, message, senddate from appuser_message where id = #{id,jdbcType=VARCHAR} order by senddate asc </select> </mapper> ``` ``` //实体类 package bean; import java.util.Date; public class AppMessage { private String id; private String message; private Date senddate; public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public String getMessage() { return message; } public void setMessage(String message) { this.message = message == null ? null : message.trim(); } public Date getSenddate() { return senddate; } public void setSenddate(Date senddate) { this.senddate = senddate; } } ``` ``` //启动类 package com.shuai.spring_boot_1; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; /** * Hello world! * */ @ComponentScan(basePackages="controller") @SpringBootApplication public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); } } ``` ``` pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.5.RELEASE</version> </parent> <groupId>com.shuai</groupId> <artifactId>spring-boot-1</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>spring-boot-1</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <!--web应用基本环境配置 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <version>1.3.5.RELEASE</version> </dependency> --> </dependencies> <build> <plugins> <!-- spring-boot-maven-plugin插件就是打包spring boot应用的 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` ``` #properties文件 spring.datasource.url=jdbc:mysql://localhost:3306/world spring.datasource.username=root spring.datasource.password=000000 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.max-idle=10 spring.datasource.max-wait=10000 spring.datasource.min-idle=5 spring.datasource.initial-size=5 server.port=8012 server.session.timeout=10 server.tomcat.uri-encoding=UTF-8 # mybatis.config= classpath:mybatis-config.xml mybatis.mapperLocations=classpath:mappers/*.xml # domain object's package #mybatis.typeAliasesPackage=com.lgp.SpringBoot.bean mybatis.typeAliasesPackage=bean # handler's package # mybatis.typeHandlersPackage= # check the mybatis configuration exists # mybatis.check-config-location= # mode of execution. Default is SIMPLE # mybatis.executorType= ``` ![图片说明](https://img-ask.csdn.net/upload/201904/11/1554976465_217387.png) 错误日志

spring boot 访问报错

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed Nov 21 21:00:12 GMT+08:00 2018 There was an unexpected error (type=Not Found, status=404). No message available! [图片说明](https://img-ask.csdn.net/upload/201811/21/1542805502_509579.jpg) #Tomcat server: tomcat: uri-encoding: UTF-8 max-threads: 1000 min-spare-threads: 30 port: 8081 #mysql spring: profiles: active: dev jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss datasource: driver-class-name: com.mysql.jdbc.Driver druid: initial-size: 3 min-idle: 3 max-active: 10 max-wait: 60000 validation-query: SELECT 1 test-while-idle: true test-on-borrow: false test-on-return: false pool-prepared-statements: true use-global-data-source-stat: true min-evictable-idle-time-millis: 300000 time-between-eviction-runs-millis: 60000 max-open-prepared-statements: 20 max-pool-prepared-statement-per-connection-size: 20 slf4j: enabled: true wall: enabled: true web-stat: enabled: true url-patterns: '/*' exclusions: '*.gif,*.jpg,*.jpeg,*.png,*.bmp,*.swf,*.ico,*.woff,*.woff2,*.ttf,*.eot,*.js,*.css,*.html,*.htm,/druid/*' stat-view-servlet: enabled: true url-mappings: '/druid/*' allow: 127.0.0.1 deny: 192.168.2.1 login-username: admin login-password: 123456 reset-enable: false freemarker: request-context-attribute: req #req访问request suffix: .html #后缀名 content-type: text/html enabled: true cache: false #缓存配置 template-loader-path: classpath:/static/templates/ #模板加载路径 按需配置 charset: UTF-8 #编码格式 返回是json 格式的,能提示这么错误么? @RestController public class TestController { @Autowired private ICityPyService cityPyService; @RequestMapping(value = "/",method = RequestMethod.GET) public String test(){ CityPy city = cityPyService.queryCityPyById(1L); return "webapp start.."; } } 请求地址:http://127.0.0.1:8080/ ![图片说明](https://img-ask.csdn.net/upload/201811/21/1542806010_583411.png)

java springboot 项目引用thymeleaf-layout-dialect后启动报错

利用thymeleaf模版引擎实现layout母版页嵌套。需要引用thymeleaf-layout-dialect 。但是一引用java项目就启动失败。错误代码: ![图片说明](https://img-ask.csdn.net/upload/202004/19/1587266044_243282.png) 只要去掉这个引用就能启动成功。 附上pom的配置: ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.codes</groupId> <artifactId>blog</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>jar</packaging> <name>Blog</name> <description>Blog</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.5.RELEASE</version> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <swagger.version>2.9.2</swagger.version> <swagger.bootstrap-ui.version>1.9.6</swagger.bootstrap-ui.version> <fastjson.version>1.2.25</fastjson.version> <mybatis.version>1.3.0</mybatis.version> <druid.version>1.1.0</druid.version> <mybatis.generator.version>1.3.2</mybatis.generator.version> </properties> <dependencies> <!-- Spring Boot --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> <version>2.2.6.RELEASE</version> </dependency> <dependency> <groupId>nz.net.ultraq.thymeleaf</groupId> <artifactId>thymeleaf-layout-dialect</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <!-- 开发工具 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <!-- MyBatis plus --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.3.1</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>3.3.1.tmp</version> </dependency> <!-- 模版引擎 --> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.30</version> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.13</version> </dependency> <!-- 连接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${druid.version}</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <!-- <version>5.1.6</version>--> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- swagger --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${swagger.version}</version> </dependency> <!-- swagger-ui --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>${swagger.version}</version> </dependency> <!-- lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <!-- 工具包 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <!-- fast json依赖 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency> <!-- jwt --> <dependency> <groupId>com.auth0</groupId> <artifactId>java-jwt</artifactId> <version>3.10.2</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.codes.Application</mainClass> </configuration> </plugin> <!-- MyBatis Generator --> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>${mybatis.generator.version}</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> <configurationFile>src/main/resources/generator/generator.xml</configurationFile> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>8</source> <target>8</target> </configuration> </plugin> </plugins> <!--这个元素描述了项目相关的所有资源路径列表,例如和项目相关的属性文件,这些资源被包含在最终的打包文件里。--> <resources> <resource> <!-- 描述存放资源的目录,该路径相对POM路径--> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build> </project> ``` 感谢各位大佬帮忙!

spring-boot-starter-web-2.1.7.RELEASE.jar的依赖问题

spring-boot-starter-web-2.1.7.RELEASE.jar包下只有一个META-INF/MANIFEST.MF文件,maven是怎么知道它依赖了spring-web,spring-mvc的?

spring boot oauth2 获取到access_token之后访问资源返回Cannot convert access token to JSON

![图片说明](https://img-ask.csdn.net/upload/201810/17/1539770050_142385.png)已经获取到access_token,携带token访问资源时返回Cannot convert access token to JSON ![图片说明](https://img-ask.csdn.net/upload/201810/17/1539770112_288593.png) 这是什么问题。。。有没有人碰到过,后台也没提示报错之类的

spring boot 使用MockMvc进行单元测试,响应返回一直404

下面是相关代码: controller层 @RestController @RequestMapping("/studentTest/") public class StudentControllerTest { @Autowired private StudentDao studentDao; @RequestMapping(value = "insertStudent.html",method = RequestMethod.POST,produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}) public String insertStudent(@RequestParam("name") String name, @RequestParam("age") String age, @RequestParam("sex") String sex){ Student stu = new Student(); System.out.println(UUID.randomUUID().toString()); stu.setId(UUID.randomUUID().toString()); stu.setName(name); stu.setAge(age); stu.setSex(sex); studentDao.insertStudent(stu); return "success"; } } 测试类: @RunWith(SpringRunner.class) @SpringBootTest @ComponentScan(basePackages = "com.tjf.learn") public class Demo1ApplicationTests { private MockMvc mockMvc; @Before public void initMockMvc (){ this.mockMvc = MockMvcBuilders.standaloneSetup(new IndexController()).build(); } @Test public void insertStudent () throws Exception{ RequestBuilder rb = MockMvcRequestBuilders.post("/studentTest/insertStudent.html") .param("name","张三") .param("age","20") .param("sex","1") .contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON_UTF8); mockMvc.perform(rb) // .andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); } } 求哪位大神解决一下

spring boot 接受不到vue前台上传的图片的base64编码?

vue前台代码 ![图片说明](https://img-ask.csdn.net/upload/202003/12/1584003789_172930.png) 使用是post请求 ![图片说明](https://img-ask.csdn.net/upload/202003/12/1584003842_648987.png) 后台代码 ![图片说明](https://img-ask.csdn.net/upload/202003/12/1584003910_441918.png) 后台返回结果为0,代码前台传的参数,后台未接受到 传的参数是图片的base64编码的字符串 ![图片说明](https://img-ask.csdn.net/upload/202003/12/1584004066_624519.png) ![图片说明](https://img-ask.csdn.net/upload/202003/12/1584004251_467769.png)

前端传递json数据给后台出问题了JSON parse error

前端传递json数据给后台爆出这样 的异常, JSON parse error: Cannot deserialize instance of `com.core.entiy.Listentiy` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `com.core.entiy.Listentiy` out of START_ARRAY token at [Source: (PushbackInputStream); line: 1, column: 1]] 有哪位大神指点一下啊![图片说明](https://img-ask.csdn.net/upload/202004/04/1585975088_613804.jpg) 这是js代码![图片说明](https://img-ask.csdn.net/upload/202004/04/1585975103_7479.jpg)这是springmvc中的代码,求指点

求大神!! SpringbootAdmin2.1.4 解析gson类型的json出错

springboot2.1.4版本. 默认使用json转换器gson(spring.http.converters.preferred-json-mapper=gson), 使用springbootAdmin监控时, beans会报错Forgot to register a type adapter? ![图片说明](https://img-ask.csdn.net/upload/201904/22/1555921545_198734.png) 问题:springbootAdmin使用默认的jackson没问题,怎么能兼容gson?

2019 Python开发者日-培训

2019 Python开发者日-培训

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

设计模式(JAVA语言实现)--20种设计模式附带源码

设计模式(JAVA语言实现)--20种设计模式附带源码

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

java后台+微信小程序 实现完整的点餐系统

java后台+微信小程序 实现完整的点餐系统

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

2019 AI开发者大会

2019 AI开发者大会

玩转Linux:常用命令实例指南

玩转Linux:常用命令实例指南

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

4小时玩转微信小程序——基础入门与微信支付实战

4小时玩转微信小程序——基础入门与微信支付实战

Git 实用技巧

Git 实用技巧

Python数据清洗实战入门

Python数据清洗实战入门

使用TensorFlow+keras快速构建图像分类模型

使用TensorFlow+keras快速构建图像分类模型

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

程序员的算法通关课:知己知彼(第一季)

程序员的算法通关课:知己知彼(第一季)

MySQL数据库从入门到实战应用

MySQL数据库从入门到实战应用

机器学习初学者必会的案例精讲

机器学习初学者必会的案例精讲

手把手实现Java图书管理系统(附源码)

手把手实现Java图书管理系统(附源码)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

.net core快速开发框架

.net core快速开发框架

玩转Python-Python3基础入门

玩转Python-Python3基础入门

Python数据挖掘简易入门

Python数据挖掘简易入门

微信公众平台开发入门

微信公众平台开发入门

程序员的兼职技能课

程序员的兼职技能课

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

HoloLens2开发入门教程

HoloLens2开发入门教程

微信小程序开发实战

微信小程序开发实战

Java8零基础入门视频教程

Java8零基础入门视频教程

相关热词 c#跨线程停止timer c#批量写入sql数据库 c# 自动安装浏览器 c#语言基础考试题 c# 偏移量打印是什么 c# 绘制曲线图 c#框体中的退出函数 c# 按钮透明背景 c# idl 混编出错 c#在位置0处没有任何行
立即提问