How autowired service in a component

I create one project with springboot integration. But now I need to create one component (a visual compoentn with 2 Textfield, 1 text field is a zip code and another with the city name, so when my user insert the zip code I search im my base if I already have this city) but in this component I need to receive some another information to…

So How can I inject my zipcodeService into this component? I need to inject in my parent and pass to my component? or can I use @Autowired inside this component?

sample on image

tks
image.png

You answered your question yourself . You can inject only from @route or equivalent

You can also add @SpringComponent with a scope ( prototype, UI) to your component and inject it into your view. You have some examples here: Scopes | Spring | Integrations | Vaadin Docs