hello-spring-function-azure icon indicating copy to clipboard operation
hello-spring-function-azure copied to clipboard

No dependency injection example availability

Open parameshjava opened this issue 4 years ago • 1 comments

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Not able to find now Hello component used in the function.

https://github.com/Azure-Samples/hello-spring-function-azure/blob/0767275787db2c1354e6f657a49d4a395b07a432/src/main/java/com/example/Hello.java#L11-L17

Can we use same object across multiple https triggers?

parameshjava avatar Oct 04 '21 11:10 parameshjava

The Hello Spring bean is the function, it is configured through https://github.com/Azure-Samples/hello-spring-function-azure/blob/master/src/main/java/com/example/HelloHandler.java (this is mostly boilerplate code, and one of our goals with the Spring team is to remove it).

So you typically don't inject it anywhere. However you can totally create other Spring beans and inject them into the Hello function, for example you could have a service or a repository that are injected in this class, using the usual autowiring or contructor-based injection from Spring.

jdubois avatar Oct 04 '21 12:10 jdubois