/**
 * Copyright OPS4J
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.ops4j.pax.wicket.internal.injection.spring;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;

public abstract class AbstractSpringBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {

    @Override
    public void doParse(Element element, BeanDefinitionBuilder bean) {
        bean.addPropertyReference("bundleContext", "bundleContext");
        prepareInjection(element, bean);
        bean.setLazyInit(false);
        bean.setInitMethodName("start");
        bean.setDestroyMethodName("stop");
    }

    protected abstract void prepareInjection(Element element, BeanDefinitionBuilder bean);

    protected void addPropertyValueFromElement(String id, Element element, BeanDefinitionBuilder bean) {
        String beanElement = element.getAttribute(id);
        bean.addPropertyValue(id, beanElement);
    }

    protected void addPropertyReferenceFromElement(String id, Element element, BeanDefinitionBuilder bean) {
        String beanElement = element.getAttribute(id);
        bean.addPropertyReference(id, beanElement);
    }

}

@@ -990,35 +990,38 @@
 initionBuilder b
-ean
+uilder
 ) %7B%0A        bean
@@ -1009,35 +1009,38 @@
 der) %7B%0A        b
-ean
+uilder
 .addPropertyRefe
@@ -1115,19 +1115,22 @@
 ement, b
-ean
+uilder
 );%0A     
@@ -1129,27 +1129,30 @@
 );%0A        b
-ean
+uilder
 .setLazyInit
@@ -1165,27 +1165,30 @@
 );%0A        b
-ean
+uilder
 .setInitMeth
@@ -1213,19 +1213,22 @@
        b
-ean
+uilder
 .setDest
@@ -1246,24 +1246,65 @@
 me(%22stop%22);%0A
+        super.doParse(element, builder);%0A
     %7D%0A%0A    p

Make sure that identified bean type is accepted and call super in AbstractSpringBeanDefinitionParser