I am implementation another implementation for existing interface using Spring and Apache CXF. When tomcat is starting up, it show below error message :
Method getSomething in ModuleInterface has no JAX-RS Path or HTTP Method annotations
And, both endpoints are returning 404.
I am not sure what am I missing. Any idea anyone?
public interface ModuleInterface {
public Response getSomething(@Valid RequestObj obj);
}
--
@Service
@Path("/foo")
public class FooClass implements moduleInterface {
public Response getSomething(@Valid Request obj){
// code
}
}
--
@Service
@Path("/new/foo")
public class FooV2Class implements moduleInterface {
public Response getSomething(@Valid Request obj){
// code
}
}
--
@Configuration
@ImportResource({"classpath:/META-INF/cxf/cxf-servlet.xml", "classpath:/META-INF/cxf/cxf.xml"})
public class APIConfig {
@Autowired @Lazy ModuleInterface moduleInterface;
@Bean
public Server initCxfServer(){
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setServiceBeanObjects(getJaxRsResources());
sf.setProviders(Arrays.asList(
new JacksonJaxbJsonProvider()
));
return sf.create();
}
private Object[] getJaxRsResources() {
return new Object[]{
moduleInterface
};
}
private HashMap getExtMaps() {
return new HashMap<String,String>(){{
put("json","application/json;charset=utf-8");
put("xml","application/xml;charset=utf-8");
put("wadl","application/vnd.sun.wadl+xml");
put("desc","application/vnd.sun.desc+json;charset=utf-8");
}};
}