0

I'm working in a project using Spring Cloud Function for AWS Lambda. I noticed that there are few examples on extending SpringBootRequestHandler for handling specific type of input and output.

But, my project has a requirement where the input json object is random. Thus, I'm unable define a Java class, which is mandatory for the SpringBootRequestHandler implementation.

Currently, my handler class extending SpringBootStreamHandler looks something like below:

public class CustomHandler extends SpringBootStreamHandler {

  @Autowired
  private BeanA beanA;

  @Override
  public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
    // Call initialize to autowire beanA
    this.initialize(); 
    // Business logic to parse partial of json input into an object.
    ....
  }
}

But, is there a way which I can abstract the business logic to another class extending Function which is similar to the SpringBootRequestHandler implementation?

@Component
public class CustomFunction extend Function<?,?> {
  // Business logic
  ........
}

Chamila Maddumage
  • 3,304
  • 2
  • 32
  • 43
mengjiann
  • 275
  • 3
  • 12
  • This seems like a valid concern, so feel free to raise an issue [here](https://github.com/spring-cloud/spring-cloud-function/issues) and we'll look at it – Oleg Zhurakousky Mar 27 '19 at 06:02
  • 1
    Thanks for the pointer. Here is the [github issue](https://github.com/spring-cloud/spring-cloud-function/issues/349) – mengjiann Mar 27 '19 at 15:23

0 Answers0