spring - New Functional Web Framework with jetty -


i wanted setup example new in spring 5: functial web framework set routeconfiguration:

@configuration public class routeconfiguration {      @autowired     private myservice myservice;      @bean     public routerfunction<?> routerfunction() {         return route(                 get("/first")                 , myservice::getitemsfirst)                 .and(route(                         get("/second")                         , myservice::getitemssecond));     } } 

i started application using jetty , @ first seemed work... until wanted call 1 of methods: localhost:8080/first , returned 404.

did define route configuration wrong or why arent routes accessible?

edit

with netty need provide server configuration following:

@configuration public class httpserverconfiguration {      @autowired     private environment environment;      @bean     public httpserver httpserver(final routerfunction<?> routerfunction) {         final httphandler httphandler = routerfunctions.tohttphandler(routerfunction);         final reactorhttphandleradapter adapter = new reactorhttphandleradapter(httphandler);         final httpserver server = httpserver.create("localhost", integer.valueof(this.environment.getproperty("server.port")));         server.newhandler(adapter);         return server;     } } 

but not find jetty.

edit 2

my dependencies:

repositories {     mavencentral()     maven { url "https://repo.spring.io/snapshot" }     maven { url "https://repo.spring.io/milestone" } }  dependencymanagement {     dependencies {         dependency (group: 'org.springframework.cloud', name: 'spring-cloud-starter-consul-discovery', version: '2.0.0.m1')          dependencyset (group: 'org.hibernate', version: '5.2.8.final') {             entry 'hibernate-core'             entry 'hibernate-entitymanager'             entry 'hibernate-spatial'         }     } }  dependencies {     compile('org.springframework.boot:spring-boot-starter-hateoas')     compile('org.springframework.boot:spring-boot-starter-jetty')     compile('org.springframework.boot:spring-boot-starter-webflux') {         exclude module: 'spring-boot-starter-reactor-netty'     }     compile('org.springframework.boot:spring-boot-starter-actuator')     compile('org.springframework.boot:spring-boot-autoconfigure')     compile('org.springframework.boot:spring-boot-actuator')      compile('org.springframework.cloud:spring-cloud-starter-consul')     compile('org.springframework.cloud:spring-cloud-starter-consul-discovery')      testcompile('org.springframework.boot:spring-boot-starter-test')     testcompile('junit:junit') } 

spring-boot version: 2.0.0.m3

reading comments, seems issue dependencies bringing spring-boot-starter-web; if present, spring mvc application started spring boot.

there's way explicitly tell spring boot type of application, in main application class:

public static void main(string[] args) {      springapplication application = new springapplication(agentapplication.class);     application.setwebapplicationtype(webapplicationtype.react‌​ive);     application.run(args); } 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -