package com.example.consumerapi;


import java.io.Serializable;

import java.util.Date;


public class ConsumerLog implements Serializable {


private static final long serialVersionUID = 1L;

private String id;

private Date data;

private String ip;

private String request;

private String status;

private String useragent;


public long getSerialVersionUID() {

return serialVersionUID;

}


public String getId() {

return id;

}


public void setId(String id) {

this.id = id;

}


public Date getData() {

return data;

}


public void setData(Date data) {

this.data = data;

}


public String getIp() {

return ip;

}


public void setIp(String ip) {

this.ip = ip;

}


public String getRequest() {

return request;

}


public void setRequest(String request) {

this.request = request;

}


public String getStatus() {

return status;

}


public void setStatus(String status) {

this.status = status;

}


public String getUseragent() {

return useragent;

}


public void setUseragent(String useragent) {

this.useragent = useragent;

}


@Override

public String toString() {

return "pojoConsumerAPI [id=" + id + ", data=" + data + ", ip=" + ip + ", request=" + request + ", status="

+ status + ", useragent=" + useragent + "]";

}

}



<------>


package com.example.consumerapi.test;


import java.util.List;


import org.springframework.core.ParameterizedTypeReference;

import org.springframework.http.HttpMethod;

import org.springframework.http.ResponseEntity;

import org.springframework.web.client.RestTemplate;


import com.example.consumerapi.ConsumerLog;


public class chamaAPI {


public static void main(String[] args) {


RestTemplate restTemplate = new RestTemplate();

ResponseEntity<List<ConsumerLog>> response = restTemplate.exchange("http://localhost:8080/api/log/retrieve",

HttpMethod.GET, null, new ParameterizedTypeReference<List<ConsumerLog>>() {

});

List<ConsumerLog> consumerLogs = response.getBody();

for (ConsumerLog log : consumerLogs) {

System.out.println("");

System.out.println(log);

}

}

}



<----->



<?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>


<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>2.1.7.RELEASE</version>

<relativePath /> <!-- lookup parent from repository -->

</parent>

<groupId>br.com.teste</groupId>

<artifactId>log</artifactId>

<version>0.0.1-SNAPSHOT</version>

<name>log</name>

<description>Demo project for Spring Boot</description>


<properties>

<java.version>1.8</java.version>

</properties>


<dependencies>

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-thymeleaf</artifactId>

</dependency>


<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter</artifactId>

</dependency>


<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-data-jpa</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>

<optional>true</optional>

</dependency>


<dependency>

<groupId>org.webjars</groupId>

<artifactId>jquery</artifactId>

<version>2.2.4</version>

</dependency>


<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<version>8.0.17</version>

</dependency>


<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-jdbc</artifactId>

</dependency>


<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-test</artifactId>

<scope>test</scope>

</dependency>


<dependency>

<groupId>commons-io</groupId>

<artifactId>commons-io</artifactId>

<version>2.6</version>

</dependency>


<dependency>

<groupId>com.github.dozermapper</groupId>

<artifactId>dozer-core</artifactId>

<version>6.5.0</version>

</dependency>


</dependencies>


<build>

<plugins>

<plugin>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-maven-plugin</artifactId>

</plugin>

</plugins>

</build>


</project>



<----->

Fale conosco

  • Google+ Social Icon
  • LinkedIn Social Icon

Atendimento Comercial:

© 2020 by DescompTec