Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit b641ad1

Browse files
shaileshmishrashaileshmishra
authored andcommitted
🔨 refactored credentials
1 parent b7324e3 commit b641ad1

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

src/main/java/com/contentstack/gqlspring/MainApplication.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,10 @@ public String loadIndexPage(Model model) throws JsonProcessingException {
7070
.build();
7171
JsonNode response = gqlInstance.fetch().get("data").get("all_footer").get("items");
7272
System.out.println(response);
73-
// ObjectMapper mapper = new ObjectMapper();
74-
// List<FooterModel> footerModels = mapper.readValue(response.toString(),
75-
// new TypeReference<List<FooterModel>>() {
76-
// });
77-
// System.out.println(footerModels);
78-
model.addAttribute("index", response);
73+
ObjectMapper mapper = new ObjectMapper();
74+
List<FooterModel> dataList = mapper.readValue(response.toString(), new TypeReference<List<FooterModel>>(){});
75+
System.out.println(dataList);
76+
model.addAttribute("index", dataList);
7977
return "index";
8078
}
8179

src/main/java/com/contentstack/gqlspring/models/FooterModel.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@
66
/**
77
* The type Product.
88
*/
9-
@Data
109
public class FooterModel {
1110

1211
/**
1312
* The Title.
1413
*/
15-
@JsonProperty
1614
String title;
1715

16+
public String getTitle() {
17+
return title;
18+
}
19+
20+
public void setTitle(String title) {
21+
this.title = title;
22+
}
23+
24+
@Override
25+
public String toString() {
26+
return "FooterModel{" +
27+
"title='" + title + '\'' +
28+
'}';
29+
}
1830
}

src/main/resources/static/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<a href="/" class="card-link">
1919
<div class="card-text">Index</div>
2020
<p th:text="'content: ' + ${index.content}"></p>
21+
<p th:text="'content: ' + ${content.title}"></p>
2122
</a>
2223
</div>
2324

0 commit comments

Comments
 (0)