- 博客(16)
- 资源 (7)
- 收藏
- 关注
原创 Spring MVC中@RequestParam和@PathVariable区别
请求参数和路径变量都可以用于发送值给服务器。二者都是URL的一部分。请求参数采用key=value形式,并用"&"分隔。例如,下面的URL带有一个名为productId的请求参数,其值为3: http://localhost:8080/annotated2/view-produce?produceId=3 在传统的servlet编程中,可以使用HttpS...
2019-02-28 11:31:42 113
转载 实现Web项目多个页面之间互相通信(web多屏通信)
其实要实现web多屏通信很简单,github上有一个叫做lsbridge的项目,使用其中的lsbridge.js即可以实现多屏传输数据,而且很简单很方便。但是要求要在同一个浏览器内这是发送数据的页面:<html><head><meta charset="utf-8"/><title>test1</title>...
2019-02-27 21:37:10 2972
转载 springMvc里的mvc:resources与静态资源的访问
在进行Spring MVC的配置时,通常我们会配置一个dispatcher servlet用于处理对应的URL。配置如下:<servlet><servlet-name>mvc-dispatcher</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherS...
2019-02-27 20:20:06 230
转载 @RequestMapping的prodecues和consumes属性
produces:它的作用是指定返回值类型,不但可以设置返回值类型还可以设定返回值的字符编码;consumes: 指定处理请求的提交内容类型(Content-Type),例如application/json, text/html;一、produces的例子produces第一种使用,返回json数据,下边的代码可以省略produces属性,因为我们已经使用了注解@responseBod...
2019-02-27 13:11:24 857
转载 ajax网络请求时候的data参数应该用JSON.stringify?
最近有点困惑,在进行ajax请求填写data参数时,什么情况下该用JSON.stringify,什么时候不用,直接上json对象?我是后端开发的,有时候会看到前端传过来的数据不是我想的那样,什么原因呢?今晚再次遇到,所以就上网搜搜,果然,在前端方面,我还是太弱了。事不宜迟,赶紧记录下来。假如,我的json对象是这样的var data = { name: 'vinxent',...
2019-02-25 17:24:26 2349
原创 org.thymeleaf.exceptions.TemplateInputException:
在application.properties中加上如下配置:spring.thymeleaf.prefix=classpath:/templates
2019-02-24 19:09:08 658
原创 Spring Boot+WebSocket实现点对点式
<?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.o
2019-02-24 16:09:23 360
原创 Spring Boot+WebSocket实现广播式
<?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.o
2019-02-24 13:36:21 460
原创 springboot报错Connection is not available, request timed out after 30001ms.
需要在配置文件中加上: spring.datasource.hikari.read-only=falsespring.datasource.hikari.connection-timeout=60000spring.datasource.hikari.idle-timeout=60000spring.datasource.hikari.validation-timeout=3000s...
2019-02-21 15:56:37 11885 3
原创 Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' he
今天,在一个Spring Boot项目中遇到了跨域访问的问题。通过查阅相关资料,可知可以在配置类上重写一个方法来实现跨域访问。package com.jxufe.demotest.config;import org.springframework.context.annotation.Configuration;import org.springframework.web.se...
2019-02-20 19:36:00 13345
原创 Spring Boot项目下注入SessionFactory
@Autowired private EntityManagerFactory entityManagerFactory; public Session getSession() { return entityManagerFactory.unwrap(SessionFactory.class).openSession(); }通过getSessio...
2019-02-19 21:29:56 5576
转载 Spring Boot 整合 Redis 实现缓存操作
本文提纲一、缓存的应用场景二、更新缓存的策略三、运行 springboot-mybatis-redis 工程案例四、springboot-mybatis-redis 工程代码配置详解 运行环境:Mac OS 10.12.xJDK 8 +Redis 3.2.8Spring Boot 1.5.1.RELEASE 一、缓存的应用场景什么是缓存?在互...
2019-02-18 14:43:16 154
原创 Spring Boot整合Swagger2
引入依赖 需导入Swagger,Swagger-UI的依赖。 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> ...
2019-02-13 11:39:50 158
原创 Thymeleaf整合Spring Security,解析sec标签没有效果
今天学习了Spring Security,尝试将其和Thymeleaf进行整合。<!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"><head>&l...
2019-02-11 17:55:29 9573 10
转载 Refused to execute script from '....js' because its MIME type ('text/html') is not executable...
问题描述在整合 Spring Boot、Spring Security、Thymeleaf 的练习中,对页面进行调试时,发现如下错误提示: Refused to execute script from ‘http://localhost:8080/codelib-springsecurity-sample-web/js/ie10-viewport-bug-workaround.js’ beca...
2019-02-11 15:49:10 8068
原创 Spring Boot配置hibernate显示sql语句和格式化sql语句
server.port=8989spring.datasource.url=jdbc:mysql://localhost:3306/weather?useUnicode=true&characterEncoding=UTF-8spring.datasource.username=rootspring.datasource.password=123456spring.datasou...
2019-02-04 11:51:46 4782
Spring Boot整合Spring Batch,实现批处理
2019-03-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人