projectriff / java-function-invoker

Apache License 2.0
30 stars 29 forks source link

Should be able to autodetect function @bean on its own #108

Closed ericbottard closed 4 years ago

ericbottard commented 5 years ago

I tried with a single @Bean annotated function, inside a @Configuration class. The whole thing being packaged with the boot plugin, but in layout=NONE mode. So no main() provided by me, and no @SpringBootApplication provided by me.

I believe this should be supported, but got

Caused by: java.lang.NullPointerException
    at org.springframework.cloud.function.deployer.FunctionCreatorConfiguration$BeanCreator.getFunctionNames(FunctionCreatorConfiguration.java:392)
    at org.springframework.cloud.function.deployer.FunctionCreatorConfiguration.functionNames(FunctionCreatorConfiguration.java:138)
    at org.springframework.cloud.function.deployer.FunctionCreatorConfiguration.init(FunctionCreatorConfiguration.java:119)
ericbottard commented 5 years ago

Maybe a different case from #107 , maybe not

trisberg commented 5 years ago

Could you try again with the updated buildpack?

ericbottard commented 5 years ago

Still not working, but I think you mean that you "fixed" #107

This is a bit more involved I think

trisberg commented 5 years ago

Yes, I do hope you are getting a different exception at least.

ericbottard commented 5 years ago

Yes, that is now throwing a different exception, so #107 is rightfully closed.

dsyer commented 5 years ago

Using the Boot plugin with layout=NONE is kind of pointless isn't it (can't you just build a regular jar)?

I believe this function would be deployable if you set a Start-Class (or Main-Class but it isn't one of those really) in your MANIFEST.MF, or if you supply the main= parameter to the function.uri when you start the invoker. Is that not "magic" enough? How would the invoker detect a start class automatically with no configuration?

ericbottard commented 5 years ago

My understanding was that the invoker could blend in everything it finds in that jar to whatever context it creates (child or otherwise). That is, as a function author, I assume that everything I provide will be (the equivalent of) @ComponentScan' ed by the runtime

dsyer commented 5 years ago

You can’t @ComponentScan without a package to start from (nobody wants to scan the whole classpath).

ericbottard commented 4 years ago

Closing as WONTFIX