[ec2-user@ip-172-31-81-123 myapp]$ clear [ec2-user@ip-172-31-81-123 myapp]$ ls -l total 0 drwxrwxr-x 3 ec2-user ec2-user 32 Jun 7 22:24 webpring-buxvue [ec2-user@ip-172-31-81-123 myapp]$ ls -l webpring-buxvue/ total 4 -rw-rw-r-- 1 ec2-user ec2-user 654 Jun 7 22:24 pom.xml drwxrwxr-x 4 ec2-user ec2-user 30 Jun 7 22:24 src [ec2-user@ip-172-31-81-123 myapp]$ bash [ec2-user@ip-172-31-81-123 myapp]$ vi pom.xml [ec2-user@ip-172-31-81-123 myapp]$ ls -l total 0 drwxrwxr-x 3 ec2-user ec2-user 32 Jun 7 22:24 webpring-buxvue [ec2-user@ip-172-31-81-123 myapp]$ cd webpring-buxvue/ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l total 4 -rw-rw-r-- 1 ec2-user ec2-user 654 Jun 7 22:24 pom.xml drwxrwxr-x 4 ec2-user ec2-user 30 Jun 7 22:24 src [ec2-user@ip-172-31-81-123 webpring-buxvue]$ vi pom.xml [ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l src/ main/ test/ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l src/ main/ test/ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ ls -l src/main/java/com/example/App.java -rw-rw-r-- 1 ec2-user ec2-user 174 Jun 7 22:24 src/main/java/com/example/App.java [ec2-user@ip-172-31-81-123 webpring-buxvue]$ vi src/main/java/com/example/App.java [ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/java/com/example/App.java [ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/java/com/example/App.java package com.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); } @GetMapping("/") public String hello(@RequestParam(value = "name", defaultValue = "World") String name) { return String.format("Hello %s!", name); } } [ec2-user@ip-172-31-81-123 webpring-buxvue]$ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ mkdir -p src/main/java/resources [ec2-user@ip-172-31-81-123 webpring-buxvue]$ mkdir -p src/main/resources [ec2-user@ip-172-31-81-123 webpring-buxvue]$ rm -rf src/main/java/resources [ec2-user@ip-172-31-81-123 webpring-buxvue]$ vi src/main/resources/application.properties [ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/resources/application.properties [ec2-user@ip-172-31-81-123 webpring-buxvue]$ cat src/main/resources/application.properties server.port=8080 [ec2-user@ip-172-31-81-123 webpring-buxvue]$ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ pwd /home/ec2-user/myapp/webpring-buxvue [ec2-user@ip-172-31-81-123 webpring-buxvue]$ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ mvn clean install -DskipTests -X dependency:tree -Dorgs.slf4j.simpleLogger.showDateTime=true -Dorgs.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Dverbose [DEBUG] org.springframework:spring-web:jar:5.3.7:compile (version managed from 5.3.7) [DEBUG] org.springframework:spring-beans:jar:5.3.7:compile (version managed from 5.3.7) [DEBUG] org.springframework:spring-webmvc:jar:5.3.7:compile (version managed from 5.3.7) [DEBUG] org.springframework:spring-aop:jar:5.3.7:compile (version managed from 5.3.7) [DEBUG] org.springframework:spring-context:jar:5.3.7:compile (version managed from 5.3.7) [DEBUG] org.springframework:spring-expression:jar:5.3.7:compile (version managed from 5.3.7) [INFO] com.example:webpring-buxvue:jar:1.0-SNAPSHOT [INFO] +- junit:junit:jar:3.8.1:test [INFO] \- org.springframework.boot:spring-boot-starter-web:jar:2.5.0:compile [INFO] +- org.springframework.boot:spring-boot-starter:jar:2.5.0:compile [INFO] | +- org.springframework.boot:spring-boot:jar:2.5.0:compile [INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.5.0:compile [INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.5.0:compile [INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile [INFO] | | | +- ch.qos.logback:logback-core:jar:1.2.3:compile [INFO] | | | \- org.slf4j:slf4j-api:jar:1.7.30:compile [INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.14.1:compile [INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.14.1:compile [INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile [INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile [INFO] | +- org.springframework:spring-core:jar:5.3.7:compile [INFO] | | \- org.springframework:spring-jcl:jar:5.3.7:compile [INFO] | \- org.yaml:snakeyaml:jar:1.28:compile [INFO] +- org.springframework.boot:spring-boot-starter-json:jar:2.5.0:compile [INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.3:compile [INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.3:compile [INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.12.3:compile [INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.12.3:compile [INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.12.3:compile [INFO] | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.12.3:compile [INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.5.0:compile [INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.46:compile [INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.46:compile [INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.46:compile [INFO] +- org.springframework:spring-web:jar:5.3.7:compile [INFO] | \- org.springframework:spring-beans:jar:5.3.7:compile [INFO] \- org.springframework:spring-webmvc:jar:5.3.7:compile [INFO] +- org.springframework:spring-aop:jar:5.3.7:compile [INFO] +- org.springframework:spring-context:jar:5.3.7:compile [INFO] \- org.springframework:spring-expression:jar:5.3.7:compile [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.846 s [INFO] Finished at: 2021-06-07T22:40:23Z [INFO] Final Memory: 39M/151M [INFO] ------------------------------------------------------------------------ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ [ec2-user@ip-172-31-81-123 webpring-buxvue]$ mvn spring-boot:run & [1] 4522 [ec2-user@ip-172-31-81-123 webpring-buxvue]$ [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building webpring-buxvue 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> spring-boot-maven-plugin:2.5.0:run (default-cli) > test-compile @ webpring-buxvue >>> [INFO] [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ webpring-buxvue --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 1 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ webpring-buxvue --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ webpring-buxvue --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] skip non existing resourceDirectory /home/ec2-user/myapp/webpring-buxvue/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ webpring-buxvue --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] <<< spring-boot-maven-plugin:2.5.0:run (default-cli) < test-compile @ webpring-buxvue <<< [INFO] [INFO] [INFO] --- spring-boot-maven-plugin:2.5.0:run (default-cli) @ webpring-buxvue --- [INFO] Attaching agents: [] . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.5.0) 2021-06-07 22:42:12.425 INFO 4551 --- [ main] com.example.App : Starting App using Java 1.8.0_292 on ip-172-31-81-123.ec2.internal with PID 4551 (/home/ec2-user/myapp/webpring-buxvue/target/classes started by ec2-user in /home/ec2-user/myapp/webpring-buxvue) 2021-06-07 22:42:12.430 INFO 4551 --- [ main] com.example.App : No active profile set, falling back to default profiles: default 2021-06-07 22:42:13.523 INFO 4551 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2021-06-07 22:42:13.537 INFO 4551 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2021-06-07 22:42:13.538 INFO 4551 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46] 2021-06-07 22:42:13.588 INFO 4551 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2021-06-07 22:42:13.589 INFO 4551 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1094 ms 2021-06-07 22:42:14.081 INFO 4551 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-06-07 22:42:14.092 INFO 4551 --- [ main] com.example.App : Started App in 2.244 seconds (JVM running for 2.863) 2021-06-07 22:42:14.094 INFO 4551 --- [ main] o.s.b.a.ApplicationAvailabilityBean : Application availability state LivenessState changed to CORRECT 2021-06-07 22:42:14.095 INFO 4551 --- [ main] o.s.b.a.ApplicationAvailabilityBean : Application availability state ReadinessState changed to ACCEPTING_TRAFFIC [ec2-user@ip-172-31-81-123 webpring-buxvue]$ curl http://localhost:8080/ 2021-06-07 22:42:42.430 INFO 4551 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2021-06-07 22:42:42.431 INFO 4551 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2021-06-07 22:42:42.432 INFO 4551 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms Hello World![ec2-user@ip-172-31-81-123 webpring-buxvue]$ Open a browser and point to URL: http://ec2-3-88-0-252.compute-1.amazonaws.com:8080/
Monday, June 7, 2021
Create a test Springboot Application on EC2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment