如何从Spring FactoryBean访问Jersey bean?

时间:2013-11-07 14:04:27

标签: spring jersey code-injection

我有一个Spring BeanFactory,我需要向它注入httpHeaders。

public class SpecificFactoryBean extends SomeFactoryBean<Exception> {

    @Context
    private HttpHeaders httpHeaders;

    protected SpecificFactoryBean() {
        super(Exception.class);
    }

    @Override
    protected void doRegistration(RegistryBuilder<Exception> registryBuilder) {
        registryBuilder.registerMapper(WebApplicationException.class, new ExceptionMapper<WebApplicationException>() {
            @Override
            public int map(WebApplicationException e) {

                httpHeaders.getSomeInfo();

                return 3;
            }
        });
    }
}

现在@Context不起作用,我该怎么办呢?

0 个答案:

没有答案