Table of contents
  1. Getting Resources
  2. Set Resources
    1. Gradle




Getting Resources

  •  ClassLoader classLoader = getClass().getClassLoader();
     URL resource = classLoader.getResource(path);
    
  •   Optional<URL> url = resourceResolver.getResource("classpath:" + path);
    

Set Resources

Gradle

shadowJar {
    // Ensure resources are included
    mergeServiceFiles()
    include 'EmailTemplate/**'
}

sourceSets {
    main {
        resources {
            srcDirs = ['src/main/resources']
            include '**/*.properties', '**/*.yml' // Add any specific file patterns if needed
        }
    }
}

graalvmNative {
    toolchainDetection = false

    binaries {

        resources.autodetect()

    }
}
}