Search in sources :

Example 1 with AbstractResourceInfo

use of org.apache.cxf.jaxrs.model.AbstractResourceInfo in project cxf by apache.

the class ServerProviderFactory method injectApplicationIntoFeature.

protected void injectApplicationIntoFeature(Feature feature) {
    if (application != null) {
        AbstractResourceInfo info = new AbstractResourceInfo(feature.getClass(), ClassHelper.getRealClass(feature), true, true, getBus()) {

            @Override
            public boolean isSingleton() {
                return false;
            }
        };
        Method contextMethod = info.getContextMethods().get(Application.class);
        if (contextMethod != null) {
            InjectionUtils.injectThroughMethod(feature, contextMethod, application.getProvider());
            return;
        }
        for (Field contextField : info.getContextFields()) {
            if (Application.class == contextField.getType()) {
                InjectionUtils.injectContextField(info, contextField, feature, application.getProvider());
                break;
            }
        }
    }
}
Also used : Field(java.lang.reflect.Field) AbstractResourceInfo(org.apache.cxf.jaxrs.model.AbstractResourceInfo) Method(java.lang.reflect.Method)

Aggregations

Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 AbstractResourceInfo (org.apache.cxf.jaxrs.model.AbstractResourceInfo)1