JavaStandalone

Spring Resource Loader Example

Spring ResourceLoader sample that reads BLOB-backed resources from Oracle AI Database.

Spring#Java#SpringBoot
What this sample helps you learn

This example demonstrates how to implement a custom [Spring Resource Loader](https://docs.spring.io/spring-framework/reference/core/resources.html#resources-resourceloader) to idiomatically load blob resources (such as images or files) at application startup from an arbitrary storage backend.

What this sample demonstrates

Spring

Spring framework samples for data access, messaging, configuration, and application wiring.

Use when Java applications need Spring-managed components backed by Oracle AI Database.

Highlights

  • DatabaseResource.java defines custom Resource type extending AbstractResource
  • DatabaseResourceResolver.java implements the Spring ResourceLoaderAware and ProtocolResolver interfaces to provide a Spring Compnent capable of instantiating DatabaseResorce objects.
  • DatabaseLocation.java is a data class that maps a Resource location to a BLOB in the database.