ClassPathResource 在类路径下读取资源

public final String getPath()
public boolean exists()
public InputStream getInputStream()

WebUtils 获取web资源工具类

public static String getRealPath(ServletContext servletContext, String path)
public static Object getSessionAttribute(HttpServletRequest request, String name)
public static File getTempDir(ServletContext servletContext)

ServletRequestUtils 提供获取请求参数 并自动类型转换的功能

public static Integer getIntParameter(ServletRequest request, String name)
public static int[] getIntParameters(ServletRequest request, String name)
public static Long getLongParameter(ServletRequest request, String name)

StringUtils 提供对字符串操作的工具类
public static String[] split(String toSplit, String delimiter)
public static String collectionToCommaDelimitedString(Collection<?> coll)
public static boolean hasLength(String str)

SerializationUtils 提供序列化与反序列化
public static byte[] serialize(Object object)
public static Object deserialize(byte[] bytes)

FactoryBean 通过实现该接口可以将我们自定义的Bean注入到Spring的容器当中去
public interface FactoryBean {
T getObject() throws Exception;
Class<?> getObjectType();
boolean isSingleton();
}

ApplicationContextAware 实现这个接口可以将 ApplicationContext 注入进来
public interface ApplicationContextAware extends Aware {
void setApplicationContext(ApplicationContext applicationContext) throws BeansException;
}

InitializingBean 实现该接口可以做一些初始化动作,afterPropertiesSet方法会在容器初始化后被自动调用
public interface InitializingBean {
void afterPropertiesSet() throws Exception;
}

DisposableBean 实现该接口可以再Spring容器销毁时调用,可以在这个方法中做一些比如清理资源的动作
public interface DisposableBean {
void destroy() throws Exception;
}

BeanNameAware 实现该接口,Spring容器在启动后会把当前Bean的名字注入进来
public interface BeanNameAware extends Aware {
void setBeanName(String name);
}

ResourceLoaderAware 实现该接口可以注入ResourceLoader对象,通过它可以很方便的加载一些系统资源
public interface ResourceLoaderAware extends Aware {
void setResourceLoader(ResourceLoader resourceLoader);
}

springboot工具类相关推荐

  1. 关于springboot工具类中@Autowired注入bean,用static直接修饰,静态方法使用bean时报空指针异常错误...

    错误场景: springboot + mybatis 在工具类的静态方法中,需要使用mapper(其他bean也一样),所以最开始直接使用@Autowired进行了注入,代码如下: @Autowire ...

  2. autowired 静态方法使用_关于springboot工具类中@Autowired注入bean,用static直接修饰,静态方法使用bean时报空指针异常错误...

    错误场景: springboot + mybatis 在工具类的静态方法中,需要使用mapper(其他bean也一样),所以最开始直接使用@Autowired进行了注入,代码如下: @Autowire ...

  3. Springboot 工具类@Value取不到值

    工具类里@Value取不到值,如下图 原因是new的对象 改为 EncryptIdCardUtil类方法改为非静态方法,ConnectService类由new改为@Autowired注入 RiskSe ...

  4. SpringBoot工具类,汉字转拼音(包括繁体字)

    1.需要依赖 <dependencies><!-- 中文拼音 --><dependency><groupId>com.belerweb</grou ...

  5. SpringBoot 那些天生自带 Buff 的工具类,你用过几个?

    欢迎关注方志朋的博客,回复"666"获面试宝典 断言 断言是一个逻辑判断,用于检查不应该发生的情况 Assert 关键字在 JDK1.4 中引入,可通过 JVM 参数-enable ...

  6. 这些SpringBoot天生自带Buff工具类你都用过哪些?

    欢迎关注方志朋的博客,回复"666"获面试宝典 来源:https://juejin.cn/post/7043403364020781064 断言 断言是一个逻辑判断,用于检查不应该 ...

  7. springboot在工具类中添加service的方法,显示为空的解决方案

    springboot在工具类中添加service的方法,显示为空的解决方案 参考文章: (1)springboot在工具类中添加service的方法,显示为空的解决方案 (2)https://www. ...

  8. php 配置文件加密工具类,SpringBoot集成Jasypt安全框架以及配置文件内容加密(代码示例)...

    本篇文章给大家带来的内容是关于SpringBoot集成Jasypt安全框架以及配置文件内容加密(代码示例),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 我们在SpringBoot项 ...

  9. SpringBoot 那些自带 Buff 的工具类,你用过几个?

    今日推荐 推荐一个 Java 接口快速开发框架干掉Random:这个类已经成为获取随机数的王者Docker + Intellij IDEA,提升 10 倍生产力!笑出腹肌的注释,都是被代码耽误的诗人! ...

最新文章

  1. 15.linux-LCD层次分析(详解)
  2. String.Index
  3. LeetCode--448
  4. BS开发中常用的Javascript技术
  5. 在 SUSE 11 sp2 上安装 freeradius
  6. Mysql——Innodb和Myisam概念与数据恢复
  7. ruby中exec,system,%x的区别
  8. springmvc图片文件上传接口
  9. 最详细win7下手动搭建PHP环境:apache2.4.23+php7.0.11
  10. pip报错Failed to establish a new connection: [Errno -3] Temporary failure in name resolution‘,)‘
  11. DelphiXE4发布了
  12. 遇到 no plugin found for prefix 'tomcat 7' in the current project and in the plugin groups 的解决办法
  13. 图片存储方案介绍---七牛云存储
  14. 子图数正方形和长方形数量
  15. 在开放社区中的六年,我做着喜欢且擅长的事情,利他而自利
  16. python爬虫之QQ空间登陆获取信息(超级详细)
  17. 怎样利用闲鱼赚差价?教你在闲鱼卖货赚钱!
  18. SEO图片优化基本技巧
  19. HBuilder控制台打开方式
  20. asp.net gridview itemtemplate中控件事件获取行参数

热门文章

  1. 动画理解Dijkstra算法过程
  2. python的flask实现第三方登录怎么写_关于qq和新浪微博的第三方登陆|python|flask
  3. python二维元素向量_详解python Numpy中求向量和矩阵的范数
  4. 1.逐帧动画shader
  5. 图灵测试是不是已经Out了
  6. 详解MTK系统中字符转换问题
  7. Python 常用系统模块整理
  8. CentOS安装和配置Rsync进行文件同步
  9. 面向对象命名空间、组合
  10. [转]wireshark 实用过滤表达式(针对ip、协议、端口、长度和内容) 实例介绍