spring-cloud-function icon indicating copy to clipboard operation
spring-cloud-function copied to clipboard

Kotlin functions aren't detected as expected

Open martypitt opened this issue 2 years ago • 2 comments

Describe the bug I'm fairly certiain this is something I've done wrong, but I can't see where.

The docs suggest that this should work:

@SpringBootApplication
class FunctionalApp {

    @Bean
    fun kotlinFunction(): (String) -> String {
        return { it.toUpperCase() }
    }
}

However, the function isn't registered. Hitting /actuator/functions returns:

{
  "functionRouter": {
    "type": "FUNCTION",
    "input-type": "object",
    "output-type": "object"
  }
}

If I move the registration into Java, it works as expected:

@Configuration
public class FunctionalConfig {
    @Bean
    public Function<String, String> uppercase() {
        return input -> input.toUpperCase();
    }
}

Now, hitting /actuator/functions returns:

{
  "functionRouter": {
    "type": "FUNCTION",
    "input-type": "object",
    "output-type": "object"
  },
  "uppercase": {
    "type": "FUNCTION",
    "input-type": "string",
    "output-type": "string"
  }
}

Sample This issue was detected as part of a broader project, which has a number of issues associated with it. There's a reproducable example showing this example here - specifically note that kotlinFunction isn't registered.

martypitt avatar Apr 07 '23 13:04 martypitt

I had the same problem:

image

image

image

image

It work: image

CLD1994 avatar Apr 08 '23 18:04 CLD1994

I have the same issue as described here. I'm using spring cloud stream binder rabbit v4.0.2

fleboulch avatar May 29 '23 15:05 fleboulch

This issue has been stale for over 60 days

github-actions[bot] avatar Nov 02 '24 17:11 github-actions[bot]