java - @RestController("/xxx") maping is ignored -


i'am trying create simple, annotation based rest service have 2 distinct endpoints endpoints specified value of @restcontroller annotations. problem url provided in annotations ignored.

@restcontroller("/books") public class booksapi {  @requestmapping("/getbook") public string getbook() {     return "book"; }  @restcontroller("/movies") public class moviesapi {  @requestmapping("/getmovie") public string getmovie() {     return "movie"; }  }  @configuration @enablewebmvc @componentscan(basepackages = "application.webservices.apis") public class apiconfiguration { }  public class apisservletdispacher extends abstractannotationconfigdispatcherservletinitializer {  @override protected class<?>[] getrootconfigclasses() {     return new class<?>[] {apiconfiguration.class}; }  @override protected class<?>[] getservletconfigclasses() {     return new class<?>[0]; }  @override protected string[] getservletmappings() {     return new string[] {"/"}; } } 

so far working url is: http://localhost:8080/getbook , have changed to: http://localhost:8080/books/getbook

i'm running on wildfly 10, war packaged application.

why xxx mapping in @restcontroller("xxx") ignored ?

try use this:

@restcontroller @requestmapping("/books") public class booksapi {... 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -