Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Cloud Functions
  • Comparison with other Yandex Cloud services
    • Overview
      • Overview
      • Function interface
      • YcFunction interface
      • HttpServlet class
      • Spring Boot
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ
  1. Developing in Java
  2. Programming model
  3. Overview

Java programming model

Written by
Yandex Cloud
Updated at February 7, 2025

Cloud Functions provides four models for programming in Java: using the Function and YcFunction interfaces, the HttpServlet class, and the Spring Boot framework. The first three methods of setting a function handler involve writing their own implementations of these interfaces or classes, and the last one involves loading an application in its original form without any changes.

The difference between the Function and YcFunction models is in the presence of the invocation context. For example, if you need to work with Yandex Cloud services using the SDK, we recommend opting for YcFunction. With the HttpServlet class based model, you can get full control over the return value and HTTP method used to call the function. Just as YcFunction, it also provides access to the invocation context.

There are two separate types for the Function and YcFunction models: byte[] and String. Using them is different from using other types. If you use them as the handler function argument type, the runtime environment will not convert the incoming request into a JSON interpretation for these types and will deliver it directly to the user handler function, unless the ?integration=raw parameter is used.

Note

The library used for serialization and deserialization from JSON is jsoniter.

Handler requirementsHandler requirements

Regardless of the selected model, a project is uploaded as a source code, a JAR archive, or a Maven project. In addition, the following requirements apply to a class that contains a handler function:

  • It must be public.

  • The class must have a public no-argument constructor.

    It is included by default. However, if you created your own constructor that accepts arguments, you must also create a no-argument one.

  • It should not be generic.

Was the article helpful?

Previous
Overview
Next
Function interface
Yandex project
© 2025 Yandex.Cloud LLC