Documentos de Académico
Documentos de Profesional
Documentos de Cultura
11 DE NOVIEMBRE DE 2023
NOMBRE: JAVIER CARCHIPULLA
UNIVERSIDAD DE GUAYAQUIL
Código fuente del Proyecto en PDF.
CLASE Libro
package com.proyecto.RestApi.Models;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
@Entity
@Table (name = "libros")
public class Libro {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String titulo;
private String autor;
private String editorial;
private Integer anioPublicacion;
INTERFACE libroReposytory
package com.proyecto.RestApi.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.proyecto.RestApi.Models.Libro;
@Repository
public interface libroReposytory extends JpaRepository<Libro, Long>{
INTERFACE IlibroController
package com.proyecto.RestApi.Controller;
import java.util.List;
import com.proyecto.RestApi.Models.Libro;
CLASE LibroController
package com.proyecto.RestApi.Controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.proyecto.RestApi.Models.Libro;
import com.proyecto.RestApi.Repository.libroReposytory;
@RestController
@RequestMapping("/libro")
public class LibroController implements IlibroController{
@Autowired
private libroReposytory listalibros;
@GetMapping
public List<Libro> enlistarLibros() {
return listalibros.findAll();
}
• Después cree los paquetes que normalmente son 4 pero como usted uso 3 en el
ejemplo del miércoles lo hice con 3 y esta es la estructura de los paquetes
Capturas de pantalla de Postman o CURL mostrando las pruebas
realizadas a los endpoints
utilice la extensión thunder de visual studios code
Nos muestra un campo vacío, por esta trayendo los campos que hay, y como no hay
campos por eso vacío, en el enunciado solo nos habla de solo un GET