domingo, 14 de febrero de 2021

SPRING IN ACTION FIFTH EDITIO, PASO A PASO

 ANALISIS Y DESARROLLO PASO A PASO DEL LIBRO SPRING IN ACTION 5TH EDITION





PASO NUMERO 1 
INSTALAR INTELLIJ COMUNNITY EDITION, 

ABRIR EL CODIGO DE SPRING IN ACTION FIFHT EDITION

EL PASO DE USAR SCRIPT DE CONFIGURACION ES MUY IMPORTANTE TE APARECE EN LA PARTE INFERIOR DERECHA,  CONFIGURACION DE INTELLIJ, QUE ES SUPERIOR A ECLIPSE FOR SURE.
 
DE OTRA MANERA TE ENVIA UN ERROR DE 

Non-resolvable parent POM in SpringBoot


HAY QUE DIRECCIONAR BIEN EL JAVA_HOME, MVN Y USAR JDK Y NO JRE, ESTO ES IMPORTANTE PARA QUE COMPILE BIEN.  REVISAR BIEN VARIABLES DE AMBIENTE TANTO DE USUARIO COMO GLOBALES


VERSION CORRECTA EN JAVA_HOME Y PATH LOCAL COMO DE USUARIO

C:\Program Files\Java\jdk1.8.0_271

C:\Users\rober>java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos>mvn spring-boot:run


mvn clean

mvn install

main 


package tacos;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication // <1>
public class TacoCloudApplication {

public static void main(String[] args) {

SpringApplication.run(TacoCloudApplication.class, args); // <2>
}

}






package tacos;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller // <1>
public class HomeController {

@GetMapping("/") // <2>
public String home() {

return "home"; // <3>
}

}

VEMOS CLARAMENTE QUE ESTA EL CONTROLLER Y GETMAPPING ANNOTATIONS


REGRESA EL HOME, EL HOME.HTML




EN STATIS IMAGES SE REGRESA LA IMAGEN DE TIPO ESTATICO, ES DECIR CONSTANTE

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head>
<title>Taco Cloud</title>
</head>

<body>
<h1>Welcome to...</h1>
<img th:src="@{/images/TacoCloud.png}"/>
</body>
</html>



POM

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>sia</groupId>
<artifactId>taco-cloud</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <!--1-->

<name>taco-cloud</name>
<description>Taco Cloud Example</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version> <!--2-->
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>
UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency> <!--3-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin> <!--4-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>


GIT IGNORE
target/
!.mvn/wrapper/maven-wrapper.jar

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/


LEVANTA EN LOCALHOST 8080



******************************************************************************
LOG INICIAL

Microsoft Windows [Versión 10.0.18363.1316]
(c) 2019 Microsoft Corporation. Todos los derechos reservados.

C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos>mvn clean
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building taco-cloud 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ taco-cloud ---
[INFO] Deleting C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.889s
[INFO] Finished at: Sat Feb 13 23:40:49 CST 2021
[INFO] Final Memory: 7M/245M
[INFO] ------------------------------------------------------------------------
C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos>mvn spring-boot:run

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building taco-cloud 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) @ taco-cloud >>>
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ taco-cloud ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ taco-cloud ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ taco-cloud ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos\src\test\resou
rces
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ taco-cloud ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos\target\test-classes
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) @ taco-cloud <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) @ taco-cloud ---
[INFO] Attaching agents: []
23:41:09.600 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
23:41:09.605 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-actuator/target/classes/, /spring-boot-devtools/ta
rget/classes/, /spring-boot/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter/target/classes/]
23:41:09.606 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/Users/rober/Desktop/DELROJA_2020%20ORDEN%20TOTAL/spring-in-
action-5-samples-master/spring-in-action-5-samples-master/ch01/tacos/target/classes/]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.4.RELEASE)

2021-02-13 23:41:10.155  INFO 22500 --- [  restartedMain] tacos.TacoCloudApplication               : Starting TacoCloudApplication on DESKTOP-DLK8P3R with PID 22500 (started by rober i
n C:\Users\rober\Desktop\DELROJA_2020 ORDEN TOTAL\spring-in-action-5-samples-master\spring-in-action-5-samples-master\ch01\tacos)
2021-02-13 23:41:10.157  INFO 22500 --- [  restartedMain] tacos.TacoCloudApplication               : No active profile set, falling back to default profiles: default
2021-02-13 23:41:10.266  INFO 22500 --- [  restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebS
erverApplicationContext@5d3cf8c1: startup date [Sat Feb 13 23:41:10 CST 2021]; root of context hierarchy
2021-02-13 23:41:12.972  INFO 22500 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-02-13 23:41:13.003  INFO 22500 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-02-13 23:41:13.004  INFO 22500 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.32
2021-02-13 23:41:13.015  INFO 22500 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in prod
uction environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_271\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Co
mmon Files\Oracle\Java\javapath;C:\oracle\app\oracle\product\11.2.0\server\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Wind
ows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Manageme
nt Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\
NVIDIA Corporation\PhysX\Common;C:\maven\bin;C:\Program Files\Java\jdk1.8.0_271\\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
;C:\Program Files\Java\jdk1.8.0_271\;C:\Users\rober\Desktop\openshift\;C:\Ruby24-x64\bin;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\springCLI\bin;C:\Users\rober\AppData\L
ocal\Programs\Python\Python35\;C:\Users\rober\AppData\Local\Programs\Python\Python35\Scripts\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Us
ers\rober\Desktop\JAVAAFONDO\Java_a_fondo\hsqldb-2.5.0\hsqldb-2.5.0\hsqldb\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\oracle\app\oracle\product\11.2.0\server\bin;C
:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Prog
ram Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine
 Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\maven\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\W
INDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\rober\Desktop\openshift\;C:\Ruby24-x64\bin;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\springCLI\
bin;C:\Users\rober\AppData\Local\Programs\Python\Python35\;C:\Users\rober\AppData\Local\Programs\Python\Pyt;C:\Program Files\Java\jdk1.8.0_271\;;.]
2021-02-13 23:41:13.198  INFO 22500 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-02-13 23:41:13.199  INFO 22500 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2937 ms
2021-02-13 23:41:13.290  INFO 22500 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2021-02-13 23:41:13.295  INFO 22500 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2021-02-13 23:41:13.296  INFO 22500 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2021-02-13 23:41:13.296  INFO 22500 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2021-02-13 23:41:13.296  INFO 22500 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2021-02-13 23:41:13.452  INFO 22500 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.w
eb.servlet.resource.ResourceHttpRequestHandler]
2021-02-13 23:41:13.639  INFO 22500 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.Annotat
ionConfigServletWebServerApplicationContext@5d3cf8c1: startup date [Sat Feb 13 23:41:10 CST 2021]; root of context hierarchy
2021-02-13 23:41:13.722  INFO 22500 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String tacos.HomeController.home
()
2021-02-13 23:41:13.725  INFO 22500 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.M
ap<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2021-02-13 23:41:13.726  INFO 22500 --- [  restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servle
t.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2021-02-13 23:41:13.752  INFO 22500 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.s
ervlet.resource.ResourceHttpRequestHandler]
2021-02-13 23:41:13.753  INFO 22500 --- [  restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.r
esource.ResourceHttpRequestHandler]
2021-02-13 23:41:14.071  INFO 22500 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2021-02-13 23:41:14.112  INFO 22500 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2021-02-13 23:41:14.426  INFO 22500 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-02-13 23:41:14.433  INFO 22500 --- [  restartedMain] tacos.TacoCloudApplication               : Started TacoCloudApplication in 4.808 seconds (JVM running for 5.714)
2021-02-13 23:41:34.931  INFO 22500 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2021-02-13 23:41:34.931  INFO 22500 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2021-02-13 23:41:34.961  INFO 22500 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 28 ms


No hay comentarios:

Publicar un comentario

zen consultora

Blogger Widgets

Entrada destacada

Platzy y el payaso Freddy Vega, PLATZI APESTA, PLATZI NO SIRVE, PLATZI ES UNA ESTAFA

  Platzy y los payasos fredy vega y cvander parte 1,  PLATZI ES UNA ESTAFA Hola amigos, este post va a ir creciendo conforme vaya escribiend...