jueves, 10 de agosto de 2023

MAPSTRUCT JAVA 17

 


Dependencias de MapStruct y Lombok con MAVEN
Configuración de pom.xml:
==========================

<properties>
  <!-- ... -->
    <org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
    <org.projectlombok.version>1.18.30</org.projectlombok.version>
    <lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
</properties>

<dependencies>
  <!-- ... -->

    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
        <version>${org.mapstruct.version}</version>
    </dependency>
</dependencies>


<build>
    <plugins>
        <plugin>
        <!-- ... --> 
        </plugin>  
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-compiler-plugin</artifactId>
                 <version>3.11.0</version>
            <configuration>
                  <source>17</source>
                  <target>17</target>
             <annotationProcessorPaths>
                 <path>
                   <groupId>org.mapstruct</groupId>
                   <artifactId>mapstruct-processor</artifactId>
                   <version>${org.mapstruct.version}</version>
                 </path>
                 <path>
                  <groupId>org.projectlombok</groupId>
                  <artifactId>lombok</artifactId>
                  <version>${org.projectlombok.version}</version>
                 </path>
                 <path>
                  <groupId>org.projectlombok</groupId>
                  <artifactId>lombok-mapstruct-binding</artifactId>
                  <version>${lombok-mapstruct-binding.version}</version>
   </path>
               </annotationProcessorPaths>
            </configuration>
       </plugin>
    </plugins>
</build>

martes, 8 de agosto de 2023

Thymeleaf

Thymeleaf
=========

Para usar el formato Fecha de tipo LocalDate en la vista, se debe agregar la siguiente dependencia en el archivo pom.xml :

<dependency>
    <groupId>org.thymeleaf.extras</groupId>
    <artifactId>thymeleaf-extras-java8time</artifactId>
    <version>3.0.4.RELEASE</version>
</dependency>

En el controller para pasar una fecha de tipo LocalDate a la vista se debe realizar lo siguiente:

            model.addAttribute("currentDate", LocalDate.now());

En la vista aplicamos el formato de fecha de tipo LocalDate. 

<body>
    <h1 th:text="'Hoy es ' + ${#temporals.format(currentDate,'dd/MM/yyyy')}"></h1>
    <h2 th:text="'Hoy es ' + ${#dates.format(fecha,'dd/MM/yyyy')}"></h2> //Fecha Date
</body>










Instalar Powershell 7

Instalar Powershell Version 7 -------------------------------------- $> winget search powershell $> winget install Microsoft.Powershe...