![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SpringBoot
青山青
这个作者很懒,什么都没留下…
展开
-
springboot响应消息(http)的编码设置
一、方式一在单个REST接口上设置 @ResponseBody @RequestMapping(value = "sys/getTree1",method = RequestMethod.POST,produces="application/json;charset=UTF-8") public String getTree1(){ return "success"; }二、方式二全局配置(推荐)@Configurationpublic转载 2020-12-16 11:28:19 · 1311 阅读 · 0 评论 -
spring boot 获取jar包中的资源
public static void getJarResourceFile(String fileDir, String desDir){ //获取容器资源解析器 ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); try { //获取所有匹配的文件 Resource[] resources = resol..原创 2020-12-12 10:58:57 · 2734 阅读 · 1 评论 -
HttpRequestMethodNotSupportedException: Request method ‘GET‘ not supported]
his application has no explicit mapping for /error, so you are seeing this as a fallback.Wed Nov 25 11:39:36 CST 2020There was an unexpected error (type=Method Not Allowed, status=405).Request method 'GET' not supportedorg.springframework.web.Http.原创 2020-11-25 14:28:33 · 10977 阅读 · 1 评论 -
使用Spring PropertiesLoaderUtils读取properties属性文件
1.定义属性文件 (resources路径下:server.properties)##server infoserver.ip=192.168.59.58server.port=80802.读取private static String[] getServerInfo(String label){ String[] arr = new String[2]; try { Properties properties = Proper..转载 2020-11-12 16:12:54 · 1024 阅读 · 0 评论 -
解决JNA String(Java)与char*(c++)转换中文乱码问题
解决方法其实很简单,只需要更改下JNA中字符串编码即可,将jna 编码与C++ 保持一致。//c++ char* GBK编码时System.setProperty("jna.encoding","GBK"); //c++ char* UTF8编码时System.setProperty("jna.encoding","UTF-8"); ...转载 2020-11-06 14:35:37 · 1409 阅读 · 0 评论 -
解决springboot项目请求出现非法字符问题 java.lang.IllegalArgumentException:Invalid character found in the request t
springboot版本: 2.1.5最近使用springboot搭建了一个App后台服务的项目,开发接口的时候在本机使用postman工具做请求测试,请求返回一直很正常,但是在前端开发使用h5请求后台服务的时候,前台请求400,浏览器提示请求跨域但是我在提供接口请求的入口处做了跨域处理的,如图:所以我考虑可能不是跨域问题,查看ide控制台发现每次请求都会报如下错误:java.lang.IllegalArgumentException: Invalid character found i转载 2020-11-06 09:47:26 · 5462 阅读 · 6 评论 -
TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.
错误:Spring boot 使用 swagger 生成接口文档,总是报错:"TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body."参考了网上的方法说是,使用@ResponseBody才会在接口中获取swagger列表,我代码里面使用的"@RestController"本身就包含@ResponseBody,所以应该不是一个问题造成的,所以只能自己解决了。.原创 2020-10-27 17:22:43 · 2612 阅读 · 0 评论 -
SpringBoot 项目修改html后不需要重新启动(热部署)
基于IDEA配置:一、引入依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional></dependency>二、修改配置 1)“File” -转载 2020-10-26 11:19:07 · 1167 阅读 · 0 评论 -
Spring Boot 配置Druid连接池
1.引入依赖 <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.18</version> </dependency>2.applicat.原创 2020-10-14 16:32:53 · 3867 阅读 · 0 评论 -
springboot多数据源,配置Druid连接池不起作用问题
原创 2020-10-14 15:36:22 · 2378 阅读 · 1 评论 -
HikariPool-1 - Connection is not available, request timed out after
原因:调用dataSource.getConnection() 方法,返回的是一个数据库连接对象,使用完后没有关闭造成!!注:造成该问题的原因很多,以上只是针对我遇到的情况。原创 2020-10-14 09:18:37 · 754 阅读 · 0 评论 -
西安80 投影坐标 转 WGS84—— Java 使用proj4j库
/** * xian80 3度带 111E 转 wgs84 * @param x * @param y * @return */ public static String Xian80_To_WGS84(double x ,double y){ CRSFactory targetFactory = new CRSFactory(); CRSFactory crsFactory = new CRSFactor...原创 2020-09-21 17:01:41 · 3029 阅读 · 3 评论 -
dbutils使用---QueryRunner(query_update)、BeanList\BeanHandler、MapList\MapHandler、ScalarHandler
https://blog.csdn.net/u013210620/article/details/52739897转载 2020-09-17 10:47:29 · 154 阅读 · 0 评论 -
Spring Boot ibatis 注解中 动态传入表名
Java ibatis @Select注解中 动态传入表名举例@Select("select card_number cardNumber,name from ${tableName} where card_number=#{cardNumber}")public IdCard getIdCardByCardNumber(@Param("cardNumber") String cardNumber, @Param("tableName") String tableName);分表..转载 2020-09-16 17:39:04 · 687 阅读 · 0 评论 -
Spring Boot 配置多数据源连接错误:“jdbcUrl is required with driverClassName“
错误:### Error querying database. Cause: java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName.application.properties 配置如下:根据提示意思是jdbcUrl 要与driverClassName配合使用,然而修改成driverClassName之后,依然报之前的错误。解决方法:数据库连接中使用 jdbc-url 和dr...原创 2020-09-16 09:44:00 · 1855 阅读 · 0 评论 -
springboot+mybatis+sqlite 程序中执行插入、查询正常,但sqlite数据库文件中找不到数据
这是因为sqlite是文件数据库,放在了Resource文件夹,执行编译后会拷贝一份到target文件夹中,实际操作用的是这个数据库,打开后数据都在这个数据库中。原创 2020-09-07 10:48:02 · 1656 阅读 · 1 评论 -
Spring Boot MyBatis Postgres 实现对数据表增删改查操作(采用注解方式)
1.创建Java实体类package com.example.server;public class SceneService { private String servicename; private ServiceTypeEnum servicetype; private String serviceurl; public String getServicename() { return servicename; } .原创 2020-09-03 09:36:01 · 967 阅读 · 0 评论 -
Springboot中关于跨域问题的一种解决方法
前后端分离开发中,跨域问题是很常见的一种问题。本文主要是解决springboot项目跨域访问的一种方法,其他javaweb项目也可参考。1.首先要了解什么是跨域由于前后端分离开发中前端页面与后台在不同的服务器上,必定会出现跨区问题。关于更具体的信息,可以看这里:不要再问我跨域的问题了2.springboot中通过配置Filter来解决跨域问题2-1.首先看一下会出现跨域问题的代码:前端代码: 1 2 3 4 5 6 7...转载 2020-09-02 19:08:34 · 673 阅读 · 0 评论