![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaWeb和框架运用
XiaoCheng5200
努力努力再努力
展开
-
mybatis统一处理entity创建日期和更新日期,并对时间做偏差
mybatis统一处理entity创建日期和更新日期,并对时间做偏差原创 2023-02-24 16:19:13 · 1147 阅读 · 0 评论 -
Mybatis解决模糊查询中有通配符的情况(用Escape关键字)
Mybatis解决模糊查询中有通配符的情况(用Escape关键字)原创 2023-02-22 13:27:02 · 1631 阅读 · 0 评论 -
SpringBoot 自动装配
启动类上的注解 @SpringBootApplication 里面的 @EnableAutoConfiguration 这个注解 决定着是否开启自动装配 默认开启@EnableAutoConfiguration只是一个简单地注解,自动装配核心功能的实现实际是通过AutoConfigurationImportSelector类。public String[] selectImports(AnnotationMetadata annotationMetadata) { //判断是否原创 2021-07-12 14:02:25 · 86 阅读 · 0 评论 -
Mybatis使用的细节
no.1无论Interface Mapper里的方法有几个参数都要加上@Param("xxx") 这个注解避免无法映射Mapper.XML的参数no.2#{} 解析为一个 JDBC 预编译语句(prepared statement)的参数标记符。select * from user where name = #{name};转换为select * from user where name = ?;可以看到#{}被解析为一个参数占位符?${} 仅仅为...原创 2021-03-04 14:32:02 · 223 阅读 · 1 评论 -
IDEA 热刷新 避免重复重启服务器
修改了JAVA文件 重新编译 无需重启服务器修改了大量JAVA文件或者静态资源 Spring Boot启动类配置Tomcat配置灰色按钮刷新资源 无需重启服务器原创 2020-08-17 16:12:41 · 468 阅读 · 0 评论 -
MAVEN jar包冲突解决
jar包冲突指的是比如 A包中有com.aa.aa.test.class B包中也有com.aa.aa.test.class只有这两个包的路径及类名称完全相同时才会冲突,你在项目中引用的时候引用的是import com.aa.aa.test;你怎么确定com.aa.aa.test这个是A包的还是B包的比如流程包中有javax.el.ValueExpression这个类<dependency><grou...原创 2020-08-17 16:02:31 · 225 阅读 · 0 评论 -
Spring boot集成Swagger,并配置多个扫描路径
@Configuration@EnableSwagger2public class SwaggerConfig { // 定义分隔符 private static final String splitor = ";"; /** * 创建API应用 * api() 增加API相关信息 * 通过select()函数返回一个ApiSelectorBuilder实例,用来控制哪些接口暴露给Swagger来展现, * 本例采用指定扫描的包路径.原创 2020-07-06 15:58:05 · 1257 阅读 · 0 评论 -
Mybatis-查询权限及其子权限
Mapper-XMLJAVASQL打印原创 2020-03-19 17:25:43 · 403 阅读 · 0 评论 -
定义通用的返回对象和统一异常处理
返回正确的信息 返回错误的信息 Controller中抛出异常. 异常处理新增异常处理类GlobalExceptionHandler 再加上Controlleradvice注解原创 2018-12-06 16:00:36 · 869 阅读 · 0 评论 -
全面讲解AJAX跨域问题(no access-control-allow....)
为什么会发生AJAX跨域问题? 浏览器限制(浏览器不允许跨域) 请求跨域(发出去的请求[其中协议,域名,端口任何一个不一样,浏览器就认为是跨域的]不是本域的) 发送的是XHR类型请求(如果不是xhr类型的请求,就算跨域,浏览器也不会报错)这三个条件同时满足, 才有可能产生跨域安全问题.所以跨域问题是浏览器校验请求时发生的,和服务器端没有关系.解...原创 2018-11-30 16:40:35 · 1547 阅读 · 0 评论 -
Shiro入门整理
SpringBoot整合Shirohttp://www.cnblogs.com/ll409546297/p/7815409.htmlshiro-thymeleaf标签整合https://blog.csdn.net/u010150082/article/details/24717985shiro-rememberMehttps://www.cnblogs.com/blogxiao...原创 2018-09-21 15:06:28 · 158 阅读 · 0 评论 -
SpringBoot发送邮件总结
引入依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId></dependency>配置文件 spring.mail.host=sm...原创 2018-09-20 10:06:53 · 286 阅读 · 0 评论 -
Servlet中的各种编码问题
向客户端输出中文 response.setContentType("text/html;charset=utf-8"); 为什么表单提交的中文会出现乱码? 当表单提交时,浏览器会对中文参数值进行编码(会使用表单所在页面的字符集进行编码),而Web服务器在默认情况下会使用iso-8859-1去解码,编码和解码方式不一致时就会出现乱码. 解决POST方式时的乱码情况....原创 2018-03-26 16:05:43 · 181 阅读 · 0 评论 -
spring jpa 自动建表 字段乱序
https://my.oschina.net/u/3005325/blog/3035509原创 2019-08-02 14:33:02 · 536 阅读 · 0 评论 -
状态管理Cookie和Session和Token
会话发展史彻底理解cookie,session,token - 老刘的文章 - 知乎 https://zhuanlan.zhihu.com/p/63061864为什么需要状态管理?Web应用程序使用的是Http协议,该协议是"无状态"协议,即同一用户发了两次请求,建立了两次连接,但是服务器无法判断这两个请求是否是同一个人发出的,而我们的应用程序有时是需要判断是否为同一个客户发出...原创 2018-03-29 15:20:54 · 309 阅读 · 0 评论 -
Mybatis相关
Mybatis传参https://www.cnblogs.com/mingyue1818/p/3714162.htmlorg.apache.ibatis.binding.BindingException: Parameter 'XXX' not found解决办法https://blog.csdn.net/qq_28379809/article/details/83342196Sp...原创 2019-04-18 09:29:20 · 124 阅读 · 0 评论 -
KafKa精品文章整理
什么是kafkahttps://zhuanlan.zhihu.com/p/68052232Kafka消费者 JAVA实现http://09itblog.site/?p=860http://zhongmingmao.me/2018/10/18/kafka-consume/Kafka的Topic、Partition和Messagehttps://blog.csdn.net/l...原创 2019-07-17 14:24:37 · 111 阅读 · 0 评论 -
java实体类与ES字段对应
java实体类一般是驼峰命名 映射到数据库是下划线 数据库用logstash同步到ES上 ES字段也是下划线那怎么实现 java实体类 与 ES字段同步呢?logstash中jdbc的配置修改statement项的SQL语句用AS进行别名 例如 select student_name as studentName from student; 别名和java实体类名...原创 2019-08-19 10:07:15 · 8162 阅读 · 0 评论 -
druid依赖包 与springboot集成 报错
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSource': Unsatisfied dependency expressed through field 'basicProperties'; nested exception is org...原创 2019-08-23 15:00:13 · 367 阅读 · 0 评论 -
JWT讲解
https://mp.weixin.qq.com/s?__biz=MzI4Njg5MDA5NA==&mid=2247485189&idx=1&sn=44e9558f3a03f9c5e1ec539e1a10dbe2&chksm=ebd74604dca0cf126c64586b448ee8c7bccd51545d7a27d06b21bc75a2e390f961d7caf...原创 2019-09-16 14:35:13 · 223 阅读 · 0 评论 -
单点登录
https://www.cnblogs.com/cjsblog/p/10548022.html原创 2019-09-23 15:21:22 · 160 阅读 · 0 评论 -
SpringMVC+Spring+Mybatis的xml配置详解
首先看web.xml<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.s原创 2018-04-02 09:36:24 · 281 阅读 · 0 评论 -
Thymeleaf手动渲染,可做页面缓存.
注入两个类 @Autowired ThymeleafViewResolver thymeleafViewResolver; @Autowired ApplicationContext applicationContext;渲染方法 @RequestMapping(value="/to_list", produces="text/html") @ResponseBody...原创 2018-08-24 13:24:36 · 1143 阅读 · 0 评论 -
使用Spring-data-jpa简化数据访问层
一 start 自定义接口extends JpaRepository<,>其中已经内置了常用的增删改查和分页 或者继承BaseRepository@NoRepositoryBeanpublic interface BaseRepository<T,I extends Serializable> extends PagingAndSortingRep...原创 2018-04-15 16:03:23 · 606 阅读 · 0 评论 -
Spring Boot提升工作效率的几个小方法
一 安装Lombok 用法看这里 在这补充下eclipse装Lombok的方法 在https://projectlombok.org/download这个网址下载,最好下载到你的IDE安装目录里 下载后双击运行,它会自动检测IDE 要是它自动找不到,就点击Specify location选你...原创 2018-04-15 00:16:53 · 1335 阅读 · 0 评论 -
注解实现AOP
一 首先在Spring的配置文件中开启注解扫描 <aop:aspectj-autoproxy proxy-target-class="true"/>二 在要实现的AOP功能类上加上@Component @Aspect这两个注解三 在功能上添加通知类型 @Before 前置通知 ...原创 2018-04-11 13:54:35 · 739 阅读 · 0 评论 -
文件上传和下载
各种配置文件已经在上一篇博文中说过了,这次实例就直接贴文件上传的方法了.多文件上传案例(单文件上传去掉循环即可)@RequestMapping("/uploads.do") public String uploads(@RequestParam(value="file",required=false)MultipartFile[] files,HttpServletRequest re...原创 2018-04-02 11:27:02 · 168 阅读 · 0 评论 -
分布式配置中心
config-server(自动注册到注册中心)导包config-server , eureka discovery<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId...原创 2018-05-08 15:22:20 · 205 阅读 · 0 评论 -
路由网关(zuul)
导入web,eureka discovery,zuul包<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId></dependency><depende...原创 2018-05-08 09:54:17 · 187 阅读 · 0 评论 -
断路器
在ribbon使用断路器导入Hystrix包<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId></dependency>...原创 2018-05-07 14:31:54 · 206 阅读 · 0 评论 -
服务消费者
rest+ribbon导包 Web,Ribbon,Eureka Discovery<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId></dependency&...原创 2018-05-07 11:14:45 · 109 阅读 · 0 评论 -
微服务概念和Spring Cloud Eureka
微服务(一种架构风格,而不是一个组件或者一种框架) 一系列微小的服务共同组成 跑在自己的进程里 每个服务为独立的业务开发 独立部署 分布式的管理 单体架构(所有功能都打包到一个war包中,在一个web容器中,公用一个DB)优点:容易测试 容易部署缺点:开发效率低 代码维护难 部署不灵活(构建时间长) 稳定性不高 扩展性不高单体应用(Monolit...原创 2018-05-03 10:49:56 · 168 阅读 · 0 评论 -
Thymeleaf配置和使用
Gradle compile('org.springframework.boot:spring-boot-starter-thymeleaf') // 自定义 Thymeleaf 和 Thymeleaf Layout Dialect 的版本 ext['thymeleaf.version'] = '3.0.3.RELEASE' ext['thymeleaf-layo...原创 2018-04-17 11:08:19 · 1348 阅读 · 0 评论 -
SpringBoot-Controller在没有传入对应参数的情况下给参数赋值.
比如/to_list这个请求并没有发送User user参数,如何给user参数赋值?@RequestMapping("/to_list")public String list(Model model,User user) { model.addAttribute("user", user); return "goods_list";}import java.uti...原创 2018-08-14 16:44:31 · 5229 阅读 · 0 评论 -
JSR303 参数校验
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency>public class LoginVo {...原创 2018-08-13 16:40:59 · 309 阅读 · 0 评论 -
SpringBoot集成RestTemplate
1.导包compile('org.apache.httpcomponents:httpclient:4.5.3')2.配置类@Configurationpublic class RestConfiguration { @Autowired private RestTemplateBuilder builder; @Bean public RestTemplate re...原创 2018-07-09 09:31:56 · 732 阅读 · 0 评论 -
Quartz定时任务
1.导包// Quartzcompile('org.springframework.boot:spring-boot-starter-quartz')2.写需要定时执行的任务类(job)继承QuartzJobBean类重写executeInternal方法(这里是定时执行的代码)public class WeatherDataSyncJob extends QuartzJ...原创 2018-07-06 15:40:35 · 280 阅读 · 0 评论 -
Spring Boot集成xhEditor
界面<textarea id="md"></textarea><script type="text/javascript"> $(function(){ $("#md").xheditor({ tools:'simple', skin:'nostyle', upMultiple:true, u..原创 2018-06-04 10:34:53 · 218 阅读 · 0 评论 -
Spring-Boot--日志操作
https://blog.csdn.net/appleyk/article/details/78717388原创 2018-05-18 10:04:17 · 420 阅读 · 0 评论 -
SpringBoot整合Jedis操作Redis////点赞模块设计 - Redis缓存 + 定时写入数据库实现高性能点赞功能
导包<dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId></dependency> <dependency> <groupId>com.alibaba</原创 2018-05-08 10:42:46 · 2606 阅读 · 2 评论