Class SpringResourceLocation

java.lang.Object
org.nutz.resource.impl.ResourceLocation
tech.riemann.nif.nutz.dao.SpringResourceLocation
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class SpringResourceLocation extends org.nutz.resource.impl.ResourceLocation implements org.springframework.context.ApplicationContextAware
Spring资源定位器实现类,用于在Spring环境中扫描和加载资源文件。 该类继承自Nutz框架的ResourceLocation,并实现了Spring的ApplicationContextAware接口, 以便获取Spring应用上下文并利用其资源解析能力。
Author:
Kerbores(kerbores@gmail.com)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    Spring资源包装类,将Spring的Resource对象封装为Nutz框架的NutResource对象
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.springframework.context.ApplicationContext
    Spring应用上下文对象,用于获取资源文件
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
    id()
    获取资源定位器的唯一标识符
    void
    scan(String base, Pattern pattern, List<org.nutz.resource.NutResource> list)
    扫描指定基础路径下的资源文件,并根据正则表达式过滤符合条件的文件
    void
    setApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext)
    设置Spring应用上下文对象

    Methods inherited from class org.nutz.resource.impl.ResourceLocation

    file, getJarPath, jar

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
      Spring应用上下文对象,用于获取资源文件
  • Constructor Details

    • SpringResourceLocation

      public SpringResourceLocation()
  • Method Details

    • id

      public String id()
      获取资源定位器的唯一标识符
      Specified by:
      id in class org.nutz.resource.impl.ResourceLocation
      Returns:
      返回字符串"spring"作为该资源定位器的标识符
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class org.nutz.resource.impl.ResourceLocation
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.nutz.resource.impl.ResourceLocation
    • scan

      public void scan(String base, Pattern pattern, List<org.nutz.resource.NutResource> list)
      扫描指定基础路径下的资源文件,并根据正则表达式过滤符合条件的文件
      Specified by:
      scan in class org.nutz.resource.impl.ResourceLocation
      Parameters:
      base - 基础扫描路径
      pattern - 用于匹配文件名的正则表达式模式
      list - 用于存储扫描到的资源文件的列表
    • setApplicationContext

      public void setApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext)
      设置Spring应用上下文对象
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Parameters:
      applicationContext - Spring应用上下文实例,不能为空