Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Java 11 #1

Open
bartland opened this issue Jun 14, 2023 · 0 comments
Open

Support for Java 11 #1

bartland opened this issue Jun 14, 2023 · 0 comments

Comments

@bartland
Copy link

Thank you for this outstanding tutorial.

I am restricted to Java 11 for now. To do this I made simple updates to 2 files: pom.xml and HelloAppController.java.

pom.xml

Replace 17 with 11.

           <maven.compiler.release>11</maven.compiler.release>
           :
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <release>${maven.compiler.release}</release>
                </configuration>
            </plugin>

HelloAppController.java

Replace private record Response (String message) {...}

with

    public class Response {
        String message;
        public Response(String message) {
            Objects.requireNonNull(message);
            this.message = message;
        }
        public boolean isValid() {
            return true;
        }
        public String getMessage() { return this.message; }

      @Override
      public boolean equals(Object obj) {
        if (obj == this) return true;
        if (obj == null || obj.getClass() != this.getClass()) return false;
        Response that = (Response) obj;
        return this.message == that.message;
      }

      @Override
      public int hashCode() {
        return Objects.hash(message);
      }

      @Override
      public String toString() {
        return this.message;
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant