title: why i'm getting exception while giving inputs at local host "java.lang.IllegalArgumentException: Target object must not be null"?
body: <p>in this Controller when 'stdin.save(std);' is removed code works finr but when I add this 'stdin.save(std);' line i'm getting 'java.lang.IllegalArgumentException: Target object must not be null' this exception</p>
  
  <pre><code>package com.access6.controller;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.ui.ModelMap;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.servlet.ModelAndView;
  import com.access6.dao.StudentInt;
  import com.access6.model.Student;
  @RestController
  public class StudentContrlr {
  @Autowired
  StudentInt stdin;
  Student std;
  
  @RequestMapping("/")
  public ModelAndView home() {
  return new ModelAndView("home");
  }
  
  @RequestMapping("/addStd")
  public ModelAndView addStd(@RequestParam ("id") String id, @RequestParam ("name") String name, 
  @RequestParam ("location") String location,ModelMap mp ) {
  mp.put("id", id);
  mp.put("name", name);
  mp.put("location", location);
  stdin.save(std);
  return new ModelAndView("home");
  }
  }
  </code></pre>
  
  <p>model: @entity cannot create table in database but connection is working fine</p>
  
  <pre><code>package com.access6.model;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  @Entity
  public class Student {
  @Id
  int id;
  String name;
  String location;
  public int getId() {
  return id;
  }
  public void setId(int id) {
  this.id = id;
  }
  public String getName() {
  return name;
  }
  public void setName(String name) {
  this.name = name;
  }
  public String getLocation() {
  return location;
  }
  public void setLocation(String location) {
  this.location = location;
  }
  @Override
  public String toString() {
  return "Student [id=" + id + ", name=" + name + ", location=" + location + "]";
  }
  }
  </code></pre>
  
  <p>interface</p>
  
  <pre><code>package com.access6.dao;
  import org.springframework.data.repository.CrudRepository;
  import com.access6.model.Student;
  public interface StudentInt extends CrudRepository&lt;Student, Integer&gt; {
  }
  </code></pre>
  
  <p>Spring boot app</p>
  
  <pre><code>package com.access6;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  @SpringBootApplication
  public class DbConnect2Application {
  public static void main(String[] args) {
      SpringApplication.run(DbConnect2Application.class, args);
  }
  }
  </code></pre>
  
  <p>application.properties</p>
  
  <pre><code>spring.mvc.view.prefix= /WEB-INF/pages/
  spring.mvc.view.suffix= .jsp
  spring.h2.console.enabled=true
  spring.datasource.platform=h2
  spring.datasource.url=jdbc:h2:mem:vinanth
  </code></pre>