How create an Springboot Component

I have to create in my project a compoent to show an imagem, so I create one class for sample:

public class MyComp extends VerticalLayout{

private final MyService myservice;
 public MyComp(MyService myserviec){
   this.myservice = myservice;
 }

… my business logict
}

works if I put a @Service at this class? and Autowired this at my View? I wont be problem because this will a singleton?

You can add @SpringComponent (same as @Component but it’s easier when you are using the Vaadin Component) and you have to add a Scope.
Without a scope it will be a singleton (shared for all the users, that is not working).
You can use @UIScope or @Scope(“prototype”)…

I recommend the prototype scope.