Class S3KeyGenerator

java.lang.Object
com.example.blogs.app.storage.S3KeyGenerator

@Component public class S3KeyGenerator extends Object
Generates S3 object keys by combining file path, name, and extension.
  • Constructor Details

    • S3KeyGenerator

      public S3KeyGenerator()
  • Method Details

    • generateKey

      public String generateKey(String filePath, String fileName, String extension)
      Generates an S3 object key from file components. Ensures proper path separator between path and filename.
      Parameters:
      filePath - the storage path within the bucket
      fileName - the file name without extension
      extension - the file extension including the dot (e.g., ".png")
      Returns:
      the complete S3 object key