Giter VIP home page Giter VIP logo

consuming-rest-web-service's Introduction

Descrição

Estudo do framework Spring Boot versão 2.5.3. Spring Boot Documentation. Aplicação de estudo spring boot para consumir um RESTful Web Service. Aplicação Spring Boot.

Requerimentos

Build da aplicação exemplo via plugin maven:

Digitar mvn clean install no diretório raiz do projeto. Você deve ver uma saída semelhante a seguinte:

$ mvn clean install
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.3)

2021-07-31 18:58:34.831  INFO 7312 --- [           main] c.e.ConsumingRestWebServiceApplicationTests      : Starting ConsumingRestWebServiceApplicationTests using Java 15.0.1
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.330 s
[INFO] Finished at: 2021-07-31T18:58:38-03:00
[INFO] ------------------------------------------------------------------------

Execução da aplicação exemplo a partir do fat jar gerado:

Digitar java -jar target/consuming-rest-web-service-0.0.1-SNAPSHOT.jar no diretório raiz do projeto. Você deve ver uma saída semelhante a seguinte:

$ java -jar target/consuming-rest-web-service-0.0.1-SNAPSHOT.jar

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

2021-07-31 19:02:55.387  INFO 7431 --- [           main] com.example.FirstSpringBootApplication   : Starting ConsumingRestWebServiceApplication v0.0.1-SNAPSHOT using Java 15.0.1
2021-07-31 19:02:57.548  INFO 7431 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-07-31 19:02:57.563  INFO 7431 --- [           main] com.example.FirstSpringBootApplication   : Started ConsumingRestWebServiceApplication in 2.861 seconds (JVM running for 3.437)

Nota: Para finalizar a execução da aplicação pressionar as seguintes teclas: ctrl + c .

Execução da aplicação exemplo via plugin maven:

Digitar mvn spring-boot:run no diretório raiz do projeto. Você deve ver uma saída semelhante a seguinte:

$ mvn spring-boot:run

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

2021-07-31 18:56:36.932  INFO 7157 --- [           main] com.example.ConsumingRestWebServiceApplication   : Starting ConsumingRestWebServiceApplication using Java 15.0.1
2021-07-31 18:56:38.082  INFO 7157 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-07-31 18:56:38.091  INFO 7157 --- [           main] com.example.ConsumingRestWebServiceApplication   : Started ConsumingRestWebServiceApplication in 1.51 seconds (JVM running for 1.791)

Você deve ver o payload da resposta da integração no log da aplicação semelhante a saída:

{
    "type": "success",
    "value": {
        "id": 4,
        "quote": "Previous to Spring Boot, I remember XML hell, confusing set up, and many hours of frustration."
    }
}

API RESTful consumida

Segundo a documentação, segue link API RESTful que será consumida pela aplicação.

Referências

consuming-rest-web-service's People

Contributors

clebersonp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.