Spring boot: v2.2.4.RELEASE Tomcat: Apache Tomcat / 9.0.30 JDK: 13 Использование диалекта: org.hibernate.dialect.MySQL57Dialect help me to resolve
I получить ниже Результат в почтальоне:
{
"timestamp": "2020-02-17T02:46:49.724+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/insert"
}
Когда я нажимаю на почтальона, я получаю ниже детали в консоли затмения. Любой, помогите решить эту проблему. Консоль Eclipse:
INFO 1512 ---
[nio-8080-exec-2] [Tomcat].[localhost].[/] : Initializing
Spring Dispatcher Servlet 'dispatcher Servlet' INFO 1512 ---
[nio-8080-exec-2] o.s.web.servlet.DispatcherServlet :
Initializing Servlet 'dispatcher Servlet' INFO 1512 ---
[nio-8080-exec-2] o.s.web.servlet.DispatcherServlet :
Completed initialization in 2 ms
application.properties:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/oneacademydb?useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL57Dialect
контроллер:
@RestController @RequestMapping("/api/v1")
public class UserdetailsController {
@Autowired
private UserdetailsRepository userRepository;
@GetMapping("/users")
public List<Userdetails> getAllUsers() {
return userRepository.findAll();
} }
Приложение:
@SpringBootApplication @EnableJpaAuditing
public class OneacademyApplication {
public static void main(String[] args) {
SpringApplication.run(OneacademyApplication.class, args);
} }
Репозиторий:
@Repository
public interface UserdetailsRepository extends JpaRepository<Userdetails,Integer>{
}
Модель:
@Data
@Entity
@Table(name="Userdetails")
@EntityListeners(AuditingEntityListener.class)
public class Userdetails {
@Id
@Column
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
@Column
private String firstname;
@Column
private String lastname;
@Column
private String email;
@Column
private int mobile;
@Column
private String address;
@Column
private String state;
@Column
private String city;
@Column private int pincode;
@Column private String password;
@Column private String usertype;
@Column private int otp;
@Column private String created_user;
@Column private String updated_user;
@Column private char status;
@Override public String toString() {
return "Userdetails [id=" + id + ", firstname=" + firstname + ",
lastname=" + lastname + ", email=" + email
+ ", mobile=" + mobile + ", address=" + address + ", state=" + state + ", city=" + city + ", pincode="
+ pincode + ", password=" + password + ", usertype=" + usertype + ", otp=" + otp + ", created_user="
+ created_user + ", updated_user=" + updated_user + ", status=" + status + "]"; }
public Userdetails() {} }