perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.63k stars 1.56k forks source link

JettyServerFactory is not a functional interface multiple non-overriding abstract methods found in interface spark.embeddedserver.jetty.JettyServerFactory #990

Closed coreyjackwilson closed 5 years ago

coreyjackwilson commented 6 years ago

From: http://sparkjava.com/tutorials/jetty-request-log

Error occurs with class:

public static void main(String[] args) {
    port(8181);
    Logger logger = Logger.getLogger(MirApplication.class);

    EmbeddedServers.add(EmbeddedServers.Identifiers.JETTY, new EmbeddedJettyFactory((i, j, k) -> {
      Server server = new Server();
      server.setRequestLog(logger);
      return server;
    }));

    get("/hello", (req, res) -> "Hello World");
  }

Error message

java: incompatible types: spark.embeddedserver.jetty.JettyServerFactory is not a functional interface multiple non-overriding abstract methods found in interface spark.embeddedserver.jetty.JettyServerFactory

Please advise

victorwss commented 6 years ago

Which Jetty and Spark versions are you using?

coreyjackwilson commented 6 years ago

This is the most recent Spark: 2.7.1 The Jetty that comes with Spark: 9.4.5.v20170502

esamson33 commented 5 years ago

I tried using an anonymous class instead of the lambda expression and it works.