0

I am new to vaadin flow, I am using Polymer Template, when executing the >project it sends an error NullPointerException: null, what is missing for me to add?

@Route
public class MainView extends VerticalLayout {

    public MainView(@Autowired HelloWorld2 bean) {
        add(bean);
    }

}

@Tag("hello-world")
@HtmlImport("src/components/siptec-hello-world/hello-world.html")
@Service
public class HelloWorld2 extends PolymerTemplate<HelloWorld2Model>  {

    private static final String EMPTY_NAME_GREETING = "Please enter your 
       name";

    public interface HelloWorld2Model extends TemplateModel {
        String getName();
        void setGreeting(String greeting);
}

public HelloWorld2() {
        setId("template");
        getModel().setGreeting(EMPTY_NAME_GREETING);
}


<dom-module id="hello-world">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>
    <vaadin-text-field id="inputId" value="{{name}}" style="width: 200px"></vaadin-text-field>
    <div id="greeting">[[greeting]]</div>
  </template>
  • do you have any stacktrace that is longer than the NullPointerException? Maybe a hint from the lines of code it comes from? – Benedikt Schmidt Nov 28 '18 at 08:03
  • The problem is because spring could not generate the Bean, I solved it that way. public class MainView extends VerticalLayout { public MainView(HelloWorld2 bean) { add(bean); } } @BenediktSchmidt Thanks. – Ruben Castellanos Nov 29 '18 at 19:28

0 Answers0