将Spring与JaxRS集成

时间:2016-06-08 14:32:18

标签: java spring tomcat jax-rs

我正在尝试将Spring与JaxRS集成:

我正在使用此tutorial.

问题页面未找到,当我尝试从链接获取资源时:http:// localhost:8080 / customers(GET)

我写了AppConfig:

# get color transfer function/color map for 'br'
lut = GetColorTransferFunction('br')

# get opacity transfer function/opacity map for 'br'
opacityLut = GetOpacityTransferFunction('br')

# Rescale transfer function
lut.RescaleTransferFunction(-scale, scale)

# Rescale transfer function
opacityLut.RescaleTransferFunction(-scale, scale)

我已将它包含在AppInitializer中:

@Configuration
public class AppConfig extends Application {

    private Set<Object> singletons = new HashSet<Object>();
    private Set<Class<?>> empty = new HashSet<Class<?>>();

    public AppConfig() {
        singletons.add(new CustomerResource());
    }

    @Override
    public Set<Class<?>> getClasses() {
        return empty;
    }

    @Override
    public Set<Object> getSingletons() {
        return singletons;
    }
}

我也有Customer模式和CustomerResource:

public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[] {WebConfig.class, AppConfig.class};
    }

    ... some other code ...

}

0 个答案:

没有答案