spring-boot
zhzhsxx
生活态度积极乐观
展开
-
Java注解
Spring@Controller @RestController RestController = Controller + ResponseBody@RequestParam @RequestBody @PathVariable 等参数绑定注解详解Spring-Boot@Configuration注解可以达到在Spring中使用xml配置文件的作用。@Bean就等同于xml配...原创 2018-09-07 17:09:59 · 119 阅读 · 0 评论 -
【Spring-boot】使用filter对request body参数进行校验
@Slf4jpublic class ParameterCheckServletRequestWrapper extends HttpServletRequestWrapper { private byte[] requestBody; private Charset charSet; public ParameterCheckServletRequestWrap...原创 2018-11-02 12:01:50 · 8809 阅读 · 4 评论 -
【Spring-boot】通过ApplicationContextAware获取spring管理对象
用途1,在filter中使用servcie代码@Componentpublic class SpringUtils implements ApplicationContextAware { private static ApplicationContext applicationContext; @Override public void setApp...原创 2018-11-27 09:58:36 · 5120 阅读 · 0 评论 -
【Spring-boot】运行环境获取
一、类级别@Profile(“dev”)比如:可以用来控制,swagger只在测试环境使用@Profile({“dev”, “loc”})public class SwaggerConfig {}二、方法级别【Spring-boot】通过ApplicationContextAware获取spring管理对象...原创 2018-11-30 15:39:38 · 3500 阅读 · 0 评论 -
【Spring-boot】spring-batch传参数问题
Spring-boot集成spring-batch传参数时一般方法为: @Bean("step1Reader") public JdbcPagingItemReader<T> step1Reader(DataSource dataSource) { Map<String, Order> sortKeys = Maps.newHashMap(); ...原创 2018-12-18 14:13:37 · 8053 阅读 · 2 评论 -
【Spring-boot】shiro权限控制
缓存使用redis,自定义ShiroRedisCache、ShiroRedisCacheManager用于存储用户缓存信息自定义MyShiroToken继承自AuthenticationToken。用于用户名密码载体进行认证public class MyShiroToken implements AuthenticationToken { private AdminUse...原创 2019-01-07 15:28:21 · 139 阅读 · 0 评论 -
【Spring-boot】使用aop记录访问日志
引入依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId></dependency>加入记录日志功能@Slf4j@Aspect@Compo...原创 2019-01-21 11:58:22 · 239 阅读 · 0 评论 -
【Spring-boot】分离三方依赖
由于某种原因,不想使用Spring-boot默认打包方式,需要分离出依赖包:1.pom配置:<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> ...原创 2019-05-06 10:52:41 · 616 阅读 · 0 评论 -
【Spring-boot】使用spring cache缓存,集成redis
一、spring cache是spring缓存。spring-boot默认使用ConcurrentMapCacheManager作为缓存管理器,当没有指定缓存配置时使用。二、加入依赖:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>sprin...原创 2019-05-09 11:02:44 · 320 阅读 · 0 评论