Skip to content

Commit 6c51647

Browse files
committed
moving feed 8 from spring boot 2 on java 8 to spring boot 3 on jdk 17
1 parent fec78a7 commit 6c51647

File tree

9 files changed

+216
-784
lines changed

9 files changed

+216
-784
lines changed

server/feed14/service/DAOs/SearchDao.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ public async Task<IEnumerable<string>> SearchAsync(string keywords)
4444
var d = await resp.Content.ReadAsStringAsync();
4545
var jd = JsonSerializer.Deserialize<Dictionary<string, object>>(d);
4646
if (jd != null) {
47-
foreach(KeyValuePair<string, object> kvp in jd) {
48-
if (kvp.Key == "hits") {
49-
var oh = (JsonElement)kvp.Value;
50-
var ih = oh.GetProperty("hits");
51-
foreach(var ihi in ih.EnumerateArray()) {
52-
var ihsrc = ihi.GetProperty("_source");
53-
var ihsnd = ihsrc.GetProperty("sender");
54-
var ihsv = ihsnd.GetInt32();
55-
rv.Add(ihsv.ToString());
56-
}
57-
}
58-
}
59-
}
47+
foreach(KeyValuePair<string, object> kvp in jd) {
48+
if (kvp.Key == "hits") {
49+
var oh = (JsonElement)kvp.Value;
50+
var ih = oh.GetProperty("hits");
51+
foreach(var ihi in ih.EnumerateArray()) {
52+
var ihsrc = ihi.GetProperty("_source");
53+
var ihsnd = ihsrc.GetProperty("sender");
54+
var ihsv = ihsnd.GetInt32();
55+
rv.Add(ihsv.ToString());
56+
}
57+
}
58+
}
59+
}
6060
}
6161
return rv;
6262
}

server/feed8/pom.xml

Lines changed: 61 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,39 @@
1-
<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/maven-v4_0_0.xsd">
2-
<modelVersion>4.0.0</modelVersion>
3-
<groupId>info.glennengstrand</groupId>
4-
<artifactId>newsfeed-springboot</artifactId>
5-
<packaging>jar</packaging>
6-
<name>newsfeed-springboot</name>
7-
<version>1.0.0-SNAPSHOT</version>
8-
<properties>
9-
<java.version>1.8</java.version>
10-
<maven.compiler.source>${java.version}</maven.compiler.source>
11-
<maven.compiler.target>${java.version}</maven.compiler.target>
12-
<springfox-version>2.7.0</springfox-version>
13-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
15-
</properties>
16-
<parent>
17-
<groupId>org.springframework.boot</groupId>
18-
<artifactId>spring-boot-starter-parent</artifactId>
19-
<version>2.1.0.RELEASE</version>
20-
</parent>
21-
<build>
22-
<sourceDirectory>src/main/java</sourceDirectory>
23-
<plugins>
24-
<plugin>
25-
<groupId>org.springframework.boot</groupId>
26-
<artifactId>spring-boot-maven-plugin</artifactId>
27-
<executions>
28-
<execution>
29-
<goals>
30-
<goal>repackage</goal>
31-
</goals>
32-
</execution>
33-
</executions>
34-
</plugin>
35-
<plugin>
36-
<groupId>org.apache.maven.plugins</groupId>
37-
<artifactId>maven-surefire-plugin</artifactId>
38-
<configuration>
39-
<useSystemClassLoader>false</useSystemClassLoader>
40-
</configuration>
41-
</plugin>
42-
</plugins>
43-
</build>
44-
<dependencies>
45-
<dependency>
46-
<groupId>org.springframework.boot</groupId>
47-
<artifactId>spring-boot-starter-web</artifactId>
48-
<exclusions>
49-
<exclusion>
50-
<groupId>org.springframework.boot</groupId>
51-
<artifactId>spring-boot-starter-tomcat</artifactId>
52-
</exclusion>
53-
</exclusions>
54-
</dependency>
55-
<dependency>
56-
<groupId>org.springframework.boot</groupId>
57-
<artifactId>spring-boot-starter-jetty</artifactId>
58-
</dependency>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>3.4.1</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
11+
<groupId>info.glennengstrand</groupId>
12+
<artifactId>newsfeed-springboot</artifactId>
13+
<version>1.0.1-SNAPSHOT</version>
14+
<name>newsfeed-springboot</name>
15+
<description>feed 8 with the latest stable versions</description>
16+
<url/>
17+
<licenses>
18+
<license/>
19+
</licenses>
20+
<developers>
21+
<developer/>
22+
</developers>
23+
<scm>
24+
<connection/>
25+
<developerConnection/>
26+
<tag/>
27+
<url/>
28+
</scm>
29+
<properties>
30+
<java.version>17</java.version>
31+
</properties>
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-data-cassandra</artifactId>
36+
</dependency>
5937
<dependency>
6038
<groupId>org.springframework.boot</groupId>
6139
<artifactId>spring-boot-starter-data-jpa</artifactId>
@@ -66,57 +44,48 @@
6644
</dependency>
6745
<dependency>
6846
<groupId>org.springframework.boot</groupId>
69-
<artifactId>spring-boot-starter-data-cassandra</artifactId>
47+
<artifactId>spring-boot-starter-web</artifactId>
7048
</dependency>
7149
<dependency>
7250
<groupId>org.elasticsearch.client</groupId>
7351
<artifactId>elasticsearch-rest-high-level-client</artifactId>
52+
<version>7.17.26</version>
7453
</dependency>
7554
<dependency>
7655
<groupId>org.elasticsearch</groupId>
7756
<artifactId>elasticsearch</artifactId>
57+
<version>7.17.26</version>
7858
</dependency>
7959
<dependency>
8060
<groupId>redis.clients</groupId>
8161
<artifactId>jedis</artifactId>
8262
</dependency>
8363
<dependency>
84-
<groupId>mysql</groupId>
85-
<artifactId>mysql-connector-java</artifactId>
64+
<groupId>com.mysql</groupId>
65+
<artifactId>mysql-connector-j</artifactId>
66+
<version>8.3.0</version>
8667
<scope>runtime</scope>
8768
</dependency>
8869
<dependency>
89-
<groupId>com.codahale.metrics</groupId>
90-
<artifactId>metrics-core</artifactId>
91-
<version>3.0.2</version>
92-
<scope>runtime</scope>
70+
<groupId>org.springdoc</groupId>
71+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
72+
<version>2.0.0</version>
9373
</dependency>
94-
<!--SpringFox dependencies -->
95-
<dependency>
96-
<groupId>io.springfox</groupId>
97-
<artifactId>springfox-swagger2</artifactId>
98-
<version>${springfox-version}</version>
99-
</dependency>
100-
<dependency>
101-
<groupId>io.springfox</groupId>
102-
<artifactId>springfox-swagger-ui</artifactId>
103-
<version>${springfox-version}</version>
104-
</dependency>
10574

106-
<dependency>
107-
<groupId>com.github.joschi.jackson</groupId>
108-
<artifactId>jackson-datatype-threetenbp</artifactId>
109-
<version>2.6.4</version>
110-
</dependency>
111-
<!-- Bean Validation API support -->
112-
<dependency>
113-
<groupId>javax.validation</groupId>
114-
<artifactId>validation-api</artifactId>
115-
</dependency>
116-
<dependency>
117-
<groupId>org.springframework.boot</groupId>
118-
<artifactId>spring-boot-starter-test</artifactId>
119-
<scope>test</scope>
120-
</dependency>
121-
</dependencies>
75+
<dependency>
76+
<groupId>org.springframework.boot</groupId>
77+
<artifactId>spring-boot-starter-test</artifactId>
78+
<scope>test</scope>
79+
</dependency>
80+
</dependencies>
81+
82+
<build>
83+
<plugins>
84+
<plugin>
85+
<groupId>org.springframework.boot</groupId>
86+
<artifactId>spring-boot-maven-plugin</artifactId>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
12291
</project>
Lines changed: 9 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,20 @@
11
package info.glennengstrand.api;
22

3-
import java.util.Objects;
43
import com.fasterxml.jackson.annotation.JsonProperty;
5-
import com.fasterxml.jackson.annotation.JsonCreator;
6-
import io.swagger.annotations.ApiModel;
7-
import io.swagger.annotations.ApiModelProperty;
4+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
5+
import com.fasterxml.jackson.annotation.JsonAutoDetect;
86
import org.springframework.validation.annotation.Validated;
9-
import javax.validation.Valid;
10-
import javax.validation.constraints.*;
117

12-
/**
13-
* Friend
14-
*/
158
@Validated
16-
17-
public class Friend {
9+
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
10+
@JsonSerialize
11+
public record Friend(
1812
@JsonProperty("id")
19-
private Long id = null;
20-
13+
Long id,
2114
@JsonProperty("from")
22-
private String from = null;
23-
15+
String from,
2416
@JsonProperty("to")
25-
private String to = null;
26-
27-
public Friend id(Long id) {
28-
this.id = id;
29-
return this;
30-
}
31-
32-
/**
33-
* Get id
34-
* @return id
35-
**/
36-
@ApiModelProperty(value = "")
37-
38-
39-
public Long getId() {
40-
return id;
41-
}
42-
43-
public void setId(Long id) {
44-
this.id = id;
45-
}
46-
47-
public Friend from(String from) {
48-
this.from = from;
49-
return this;
50-
}
51-
52-
/**
53-
* Get from
54-
* @return from
55-
**/
56-
@ApiModelProperty(value = "")
57-
58-
59-
public String getFrom() {
60-
return from;
61-
}
62-
63-
public void setFrom(String from) {
64-
this.from = from;
65-
}
66-
67-
public Friend to(String to) {
68-
this.to = to;
69-
return this;
70-
}
71-
72-
/**
73-
* Get to
74-
* @return to
75-
**/
76-
@ApiModelProperty(value = "")
77-
78-
79-
public String getTo() {
80-
return to;
81-
}
82-
83-
public void setTo(String to) {
84-
this.to = to;
85-
}
86-
87-
88-
@Override
89-
public boolean equals(java.lang.Object o) {
90-
if (this == o) {
91-
return true;
92-
}
93-
if (o == null || getClass() != o.getClass()) {
94-
return false;
95-
}
96-
Friend friend = (Friend) o;
97-
return Objects.equals(this.id, friend.id) &&
98-
Objects.equals(this.from, friend.from) &&
99-
Objects.equals(this.to, friend.to);
100-
}
101-
102-
@Override
103-
public int hashCode() {
104-
return Objects.hash(id, from, to);
105-
}
106-
107-
@Override
108-
public String toString() {
109-
StringBuilder sb = new StringBuilder();
110-
sb.append("class Friend {\n");
111-
112-
sb.append(" id: ").append(toIndentedString(id)).append("\n");
113-
sb.append(" from: ").append(toIndentedString(from)).append("\n");
114-
sb.append(" to: ").append(toIndentedString(to)).append("\n");
115-
sb.append("}");
116-
return sb.toString();
117-
}
118-
119-
/**
120-
* Convert the given object to string with each line indented by 4 spaces
121-
* (except the first line).
122-
*/
123-
private String toIndentedString(java.lang.Object o) {
124-
if (o == null) {
125-
return "null";
126-
}
127-
return o.toString().replace("\n", "\n ");
128-
}
17+
String to) {
12918
}
13019

20+

0 commit comments

Comments
 (0)