随笔分类 - spring
spring的一些小demo
摘要:原文:https://mp.weixin.qq.com/s/Hz0gStUXe40FNiuY7rudhA 一种简单办法是,新代码先用其他端口启动,启动完毕后,更改nginx的转发地址,nginx重启非常快,这样就避免了大量的用户访问失败,最后终止老进程就可以。 新思路: 判断端口是否占用 占用则先通
阅读全文
摘要:package com.xf.config; import java.sql.Connection; import java.util.Properties; import org.apache.ibatis.executor.statement.StatementHandler; import o
阅读全文
摘要:@Bean public CorsFilter corsFilter() { CorsConfiguration config = new CorsConfiguration(); config.addAllowedOriginPattern("*"); config.setAllowCredent
阅读全文
摘要:1、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"
阅读全文
摘要:背景 在后端日常开发中总会有各种各样的导出需求,实现这个需求必须要解决的两个问题: 1、表头不能直接使用字段名,需要显示为中文,甚至还需要考虑国际化 2、值需要翻译,比如性别、状态之类的字段 现状 现在主流写的比较好的方法是定义一个对象,对象上用自定义的注解+easytrans 我的解决方案 定义要
阅读全文
摘要:package com.xf.config; import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisit
阅读全文
摘要:package com.ruoyi.framework.config; import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper; import com.baomidou.mybatisplus.core.toolkit
阅读全文
摘要:@PostConstruct对于注入到Spring容器中的类,在其成员函数前添加@PostConstruct注解,则在执行Spring beans初始化时,就会执行该函数。但由于该函数执行时,其他Spring beans可能并未初始化完成,因此在该函数中执行的初始化操作应当不依赖于其他Spring
阅读全文
摘要:package com.pj.project4sp; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.
阅读全文
摘要:引入依赖 <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> </dependency> 测试 @Test public void pas
阅读全文
摘要:Map headmap = new LinkedHashMap<String, String>(); headmap.put("createtime", "日期"); headmap.put("orderno", "案件号"); headmap.put("vin", "vin码"); headmap
阅读全文
摘要:jvm参数方式: -javaagent:D:/codesoft/elastic-apm-agent-1.18.0.jar -Delastic.apm.service_name=my-application -Delastic.apm.server_urls=http://localhost:8200
阅读全文
摘要:package study; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.security.KeyFactory; import java.security.KeyP
阅读全文
摘要:http://blog.itpub.net/31545684/viewspace-2215300/ spring cloud eureka 参数配置 https://www.jianshu.com/p/e2bebfb0d075
阅读全文
摘要:@Bean public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { SqlSessionFactoryBean fb = new SqlSessionFactoryBean(); fb.setDataSource(dataSource)...
阅读全文
摘要:Starting from Spring Boot 2.0 -web(false)/setWebEnvironment(false) is deprecated and instead Web-Application-Type can be used to specify
阅读全文
摘要:package autowired; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util...
阅读全文
摘要:package com.qmtt.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.Message; im...
阅读全文
摘要:package com.qmtt.tools; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org...
阅读全文
摘要:在网上找的demo写了一个小例子,本地开发测试都很正常,但是部署在tomcat就各种坑 1、MyWebSocket不要用spring 注解标注 2、main方法对应的类继承SpringBootServletInitializer,重写configure
阅读全文