Class GenkitSpringApplication

java.lang.Object
com.google.genkit.plugins.spring.GenkitSpringApplication

@SpringBootApplication public class GenkitSpringApplication extends Object
Spring Boot application class for Genkit.

This class is the entry point for Spring Boot auto-configuration and component scanning for the Genkit Spring plugin.

  • Constructor Details

    • GenkitSpringApplication

      public GenkitSpringApplication()
  • Method Details

    • objectMapper

      @Bean public com.fasterxml.jackson.databind.ObjectMapper objectMapper()
      Creates an ObjectMapper bean for JSON serialization.
      Returns:
      the ObjectMapper
    • genkitFlowController

      @Bean public GenkitFlowController genkitFlowController(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Creates the Genkit flow controller bean.
      Parameters:
      objectMapper - the ObjectMapper for JSON serialization
      Returns:
      the flow controller
    • genkitAgentController

      @Bean public GenkitAgentController genkitAgentController(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Creates the Genkit agent controller bean.
      Parameters:
      objectMapper - the ObjectMapper for JSON serialization
      Returns:
      the agent controller
    • genkitJackson2MessageConverterConfigurer

      @Bean public org.springframework.web.servlet.config.annotation.WebMvcConfigurer genkitJackson2MessageConverterConfigurer(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Configures Spring MVC to deserialize @RequestBody JSON using the Jackson 2 ( com.fasterxml.jackson.databind) ObjectMapper that GenkitFlowController and GenkitAgentController use for JsonNode handling.

      spring-boot-starter-web on Spring Boot 4 auto-configures a Jackson 3 ( tools.jackson.databind) message converter as the default JSON converter. Jackson 3's binder cannot construct instances of the Jackson 2 com.fasterxml.jackson.databind.JsonNode type used throughout Genkit's core action APIs, so @RequestBody JsonNode parameters would otherwise fail to bind. Prepending a MappingJackson2HttpMessageConverter backed by the Jackson 2 ObjectMapper makes it the preferred converter for application/json bodies.

      Parameters:
      objectMapper - the Jackson 2 ObjectMapper for JSON serialization
      Returns:
      the MVC configurer