title: Using models from another package in forms in Spring boot - Java
body: <p>In my <code>builds.html</code> page I have the following form:</p>
  
  <pre><code>&lt;div id="deployment"&gt;
     &lt;form action="#" th:action="@{/builds}" th:object="${build}" method="post"&gt;
        &lt;textarea rows="20" cols="150" th:field="*{configuration}"&gt;
        &lt;/textarea&gt;
        &lt;br&gt;&lt;/br&gt;
       &lt;button class="btn btn-primary btn-cons" type="submit"&gt;Deploy&lt;/button&gt;
     &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>my <code>BuildsControler.java</code> is in the <code>deployments</code> package:</p>
  
  <pre><code>import builds.Build;
  
  @Controller
  @ComponentScan("builds")
  public class BuildsController {
  
  // @Autowired
  // private BuildsRepository buildsRepository;
  private final static Logger logger = Logger.getLogger(BuildsController.class);
  
  /*
   * Add the builds url page
   */
  @GetMapping("/builds")
  public String index(Model model) {
      model.addAttribute("builds", new Build());
      return "builds";
  }
  
  /**
   * 
   * @param object
   * @return
   */
  @PostMapping("/builds")
  public Build deploy(@ModelAttribute Build build) {
      logger.info(String.format("--------- Deploying build: %s --------", build));
      return build;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>while the <code>Build</code> model is in the <code>builds</code> package:</p>
  
  <pre><code>@Document(collection = "builds")
  public class Build {
  
      @Id
      @JsonSerialize(using = ToStringSerializer.class)
      private String id;
      private String date;
  
      @NotNull
      private String configuration;
  
      public Build() {
      }
  
      public Build(String configuration) {
          this.id = new ObjectId().toHexString();
          DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
          this.date = dateFormat.format(new Date());
          this.configuration = configuration;
      }
   }
  </code></pre>
  
  <p>So I'm getting the following error:</p>
  
  <pre><code>[THYMELEAF][http-nio-8080-exec-1] Exception processing template "builds": Exception evaluating SpringEL expression: "builds.build" (builds:514)
  Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "builds.build" (builds:514)] with root cause
  org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 7): Property or field 'build' cannot be found on object of type 'builds.Build' - maybe not public?
  </code></pre>
  
  <p>How can I use the <code>build</code> model in the form, since <code>Build</code> is in another package? </p>