Bienvenida e Introducción

1

Qué aprenderás sobre Hibernate y Java Spring

2

Instalar ambiente de desarrollo en Windows

3

¿Qué es una Aplicación Empresarial?

4

¿Cómo funcionan las Aplicaciones Web?

5

Servidores Web vs Servidores de Aplicación

6

Instalar ambiente de desarrollo Mac

7

Patrón de Arquitectura MVC

8

Características de los Servlet

9

Utilización del Servlet

10

Características y práctica de JSP

Comenzar con Spring Boot

11

Arquitectura de las Aplicaciones Web

12

Características de Spring Framework

13

Características de Spring Boot

14

Crear, cargar y configurar una aplicación en Spring Boot

15

Crear la estructura del proyecto

Spring Data JPA

16

Persistencia de objetos

17

Spring Data, Spring Data JPA

18

Iniciar la base de datos postgres utilizando Docker

19

Optimizar Pojos con Lombok

20

Mapear Tablas de la Base de Datos

21

Configurar la persistencia con Hibernate

Manejo de Negocio

22

Añadir JPA Repository

23

Implementar las operaciones de Consulta con JPA Repository

24

Implementar servicio de negocio para las operaciones CRUD

25

Manejar la transaccionalidad de un servicio de negocio

Spring REST

26

Instalar y configurar Swagger

27

Características de los Servicios Web y Spring Rest

28

Implementar las operaciones REST para crear y actualizar información

29

Implementar las operaciones REST para eliminar y consultar información

30

Documentación de los servicios REST con Swagger

Spring Security

31

Manejar la seguridad en una aplicación web

32

Características, instalación e integración de Spring Security

33

Personalizar la página de Login

Despliegue Aplicaciones Docker

34

Realizar la configuración de Docker Plugin

35

Crear una imagen docker de la aplicación

36

Subir la aplicación a docker hub

37

Ejecutar la aplicación dockerizada

38

Despedida del curso

No tienes acceso a esta clase

¡Continúa aprendiendo! Únete y comienza a potenciar tu carrera

Curso de Hibernate y Java Spring 2018

Curso de Hibernate y Java Spring 2018

Marco Antonio Toscano Freire

Marco Antonio Toscano Freire

Instalar y configurar Swagger

26/38
Recursos

Swagger es una herramienta que nos permite documentar y ejecutar APIs Web de forma interactiva, provee una manera muy sencilla de implementar clientes un múltiples lenguajes. Para configurar esta herramienta junto con Spring, vamos a utilizar el proyecto Spring Fox configurando las dependencias en el archivo pom.xml.

Aportes 35

Preguntas 6

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad?

Un curso mal explicado, mal editado

que mal curso, no esta bien editado, parece como si se hubieran saltado partes.

Recuerden que los @Temporal solo pueden ser utilizados importando desde java.util.Date.
Yo tenia un error y era porque estaba importando desde java.sql.Date

pague mucha plata por estos tutos que mal

Me daba errores de swagger, finalmente pude solucionarlos siguiendo los consejos de este tutorial:
https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
En donde usan la version 2.9…

@Configuration
@EnableSwagger
Public Class SwaggerConfiguration{
            Public Docket documentation{
            return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).paths(PathSelectors.any()).build();
                                                   
      }
}


Me daba un error en RequestHandlerSelectors.
he tenido que añadir la dependencia de Guava al pom.xml. ( y clean-update proyect) para solucionarlo.

por si alguien tiene el mismo problema.

<dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>r05</version> </dependency>

Buena explicación!!!

Este vídeo quedó mal editado y se escucha al docente hablar sobre su error.

excelente clase!!!

No vi ningún video sobre la creación de clases con la anotación de @RestController y no sé de dónde salieron las clases del paquete VO, estoy perdido. Ya revisé todos los videos de nuevo y nada 😦

A mi me ah funcionado de esta manera =
<dependency>
<groupId>io.springfox.ui</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>

Muy bien

Si el atributo en la clase cliente lo declaran “private String idCliente;”, el metodo findBy… , por id se debería llamar. findByIdCliente, y no findByIdentification. Tenia ese error y por eso no me dejaba ejecutar.

Me genera este error, alguien me puede ayudar?

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project e-reservation: There are test failures.

y el link del repository de git?

Hola.
Este es el error que me ha salido y no he podido solucionar:

Test set: com.platzi.ereservation.EReservationApplicationTests

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 5.092 s <<< FAILURE! - in com.platzi.ereservation.EReservationApplicationTests
contextLoads(com.platzi.ereservation.EReservationApplicationTests) Time elapsed: 0.002 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘documentationPluginsBootstrapper’ defined in URL [jar:file:/C:/Users/jgris/.m2/repository/io/springfox/springfox-spring-web/2.7.0/springfox-spring-web-2.7.0.jar!/springfox/documentation/spring/web/plugins/DocumentationPluginsBootstrapper.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘webMvcRequestHandlerProvider’ defined in URL [jar:file:/C:/Users/jgris/.m2/repository/io/springfox/springfox-spring-web/2.7.0/springfox-spring-web-2.7.0.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘requestMappingHandlerMapping’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method ‘requestMappingHandlerMapping’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mvcConversionService’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method ‘mvcConversionService’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘reservaRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘webMvcRequestHandlerProvider’ defined in URL [jar:file:/C:/Users/jgris/.m2/repository/io/springfox/springfox-spring-web/2.7.0/springfox-spring-web-2.7.0.jar!/springfox/documentation/spring/web/plugins/WebMvcRequestHandlerProvider.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘requestMappingHandlerMapping’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method ‘requestMappingHandlerMapping’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mvcConversionService’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method ‘mvcConversionService’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘reservaRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘requestMappingHandlerMapping’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method ‘requestMappingHandlerMapping’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mvcConversionService’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method ‘mvcConversionService’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘reservaRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method ‘requestMappingHandlerMapping’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mvcConversionService’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method ‘mvcConversionService’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘reservaRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘mvcConversionService’ defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method ‘mvcConversionService’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘reservaRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method ‘mvcConversionService’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘reservaRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘reservaRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ReservaRepository.find(java.util.Date,java.util.Date)!
Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Reserva is not mapped [SELECT r FROM Reserva r WHERE r.fechaIngresoRes =:fechaInicio and r.fechaSalidaRes =:fechaSalida]
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Reserva is not mapped [SELECT r FROM Reserva r WHERE r.fechaIngresoRes =:fechaInicio and r.fechaSalidaRes =:fechaSalida]
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Reserva is not mapped

Ya en un par de videos anteriores tuve algunos errores que solucioné, pero con este si no he podido.

Apreciaría algo de ayuda

Un saludo.

Dejo este curso en este punto hasta no resolver el problema.

¿De dónde salierón las clases de los packages de vista?

Muy buen resumen marcos,ahora solo hay que ponerlo en practica.

Hola me da un error podrían por favor ayudarme a corregirlo

BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.882 s
[INFO] Finished at: 2019-03-28T12:05:40-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.0.M1:run (default-cli) on project e-reservation: An exception occurred while running. null: InvocationTargetException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NoSuchMethodError: org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin; -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Presente el error : EReservationApplicationTests.**contextLoads ** el cual fue producto de que en la clase de prueba contenía el método **contextLoads ** para evaluar. Temporalmente lo comente @test para poder continuar con las clases.

<code>public class EReservationApplicationTests {

	//@Test
	public void contextLoads() {
	}

}
</code>

Hola, tengo el siguiente error a partir de esta clase:

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.2.RELEASE:run (default-cli) on project e-reservation: An exception occurred while running. null: InvocationTargetException: Error creating bean with name ‘documentationPluginsBootstrapper’ defined in URL [jar:file:/C:/Users/emvcxsdza/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar!/springfox/documentation/spring/web/plugins/DocumentationPluginsBootstrapper.class]

Las dependencias y la clase están iguales que en el ejemplo, ¿alguien sabe de que se podría tratar?

Creo que usare okhttp para REST, esto solo hizo que todo el codigo me reventara a punto de frustrarme demasiado.

Me marcaba error en la configuración indicando un error en el parámetro 6, actualicé la versión de swagger “<version>2.10.5</version>” y cambié la anotación por “@EnableSwagger2WebMvc”…Funcionó…

Creo que aprendí mas en este curso que en los 6 meses de Java SE en la Universidad

No podía Solucionar un Error…!!

Tuve que volver a crear el Proyecto.!

Alguien sabe alguna dependencia en Maven para descargar la clase siguiente:

import org.springframework.web.bind.annotation.RestController;

No la encuentra en el paquete de spring que hicimos, les agradecería mucho.

Me da el siguiente error: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.6.RELEASE:run (default-cli) on project e-reservation: An exception occurred while running. null: InvocationTargetException: Error creating bean with name ‘clienteService’ defined in file [C:\Users\Sistemas nirvek\Documents\spring\e-reservation\e-reservation\target\classes\com\platzi\ereservation\negocio\services\ClienteService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘clienteRepository’: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List com.platzi.ereservation.negocio.repository.ClienteRepository.findbyApellidoCli(java.lang.String)! No property findbyApellidoCli found for type Cliente! -> [Help 1]
[ERROR]

En caso que se desee realizar con gradle, ¿como sería la configuración ya que no solo sería implementar las dependencias o sí?

Listo 😃

Este vídeo está mal ubicado.
Debe dar claridad que hay paquetes que se van a trabajar mas adelante y que se debe incluir la dependencia de Spring web para importar la anotación RestController.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Desarrollo/sts-4.7.0.RELEASE/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Desarrollo/sts-4.7.0.RELEASE/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Desarrollo/sts-4.7.0.RELEASE/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Desarrollo/sts-4.7.0.RELEASE/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]

Tengo este error alguien podria ayudarme?
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Desarrollo/sts-4.7.0.RELEASE/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Desarrollo/sts-4.7.0.RELEASE/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Desarrollo/sts-4.7.0.RELEASE/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Desarrollo/sts-4.7.0.RELEASE/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[INFO] Scanning for projects…
[INFO]
[INFO] ----------------------< com.pltzi:e-reservation >-----------------------
[INFO] Building e-reservation 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] — maven-clean-plugin:3.1.0:clean (default-clean) @ e-reservation —
[INFO] Deleting C:\Desarrollo\e-reservation\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.510 s
[INFO] Finished at: 2020-07-02T20:38:37-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean (default-clean) on project e-reservation: Failed to clean project: Failed to delete C:\Desarrollo\e-reservation\target\surefire-reports -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Seguí los pasos del profesor y no tuve ningún error, funciona correctamente.