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
........
}