functions-framework-java icon indicating copy to clipboard operation
functions-framework-java copied to clipboard

Can you add the support for CDI in to it?

Open AbhideepChakravarty opened this issue 5 years ago • 1 comments

Hi team,

Is it possible for you to add CDI support in it with some configuration without using anything from EJB annotation and by using just javax.inject.* annotations? As the CDI is not working along with it, its creating problem.

Or suggest a way to inject CDI into it. There is no much documentation around it. Please suggest.

Regards, Abhideep

AbhideepChakravarty avatar Aug 18 '20 10:08 AbhideepChakravarty

@eamonnmcmanus I have forked you 0.9.5-SNAPSHOT and found that port is working in that version, I wanted to fix it.

Another thing I wanted to add CDI support, which I did. WELD got integrated but somehow it is yet not able to inject the beans but thats not why I am writing this. Let's imagine that I fix that problem and integrate WELD properly with the plugin so that when in pom true is configured, WELD switches on and starts recognizing beans, but then wont that be only for local execution. And if the same code gets deployed on actual Cloud Function the CDI wont work there as it is not part of system which triggers the run i.e. starts the jetty in cloud function. So fixing the CDI in the plugin is not the solution. How would you solve this problem?

Like even port problem is only a problem in local machine, in cloud jetty will always run on 8080 and we have no control on it. So getting CDI support in plugin wont solve the problem. Hence whats the real solution and how do we go about it?

AbhideepChakravarty avatar Aug 20 '20 02:08 AbhideepChakravarty

Hi @AbhideepChakravarty, this issue has been open for quite a while and we don't currently have any plans to start supporting dependency injection in the framework.

However, if you can help provide some concrete use-cases about what you were trying to achieve, we might be able to look in to it further to see if we want to include it.

Thanks! - Joseph

josephlewis42 avatar Apr 06 '23 20:04 josephlewis42