/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.apache.camel.component.jacksonxml;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;

public class JacksonModuleRefTest extends JacksonModuleTest {

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry jndi = super.createRegistry();
        jndi.bind("myJacksonModule", new MyModule());
        return jndi;
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                JacksonXMLDataFormat format = new JacksonXMLDataFormat();
                format.setInclude("NON_NULL");
                format.setModuleRefs("myJacksonModule");

                from("direct:marshal").marshal(format).to("mock:marshal");
            }
        };
    }

}

@@ -844,16 +844,56 @@
 onxml;%0A%0A
+import org.apache.camel.BindToRegistry;%0A
 import o
@@ -930,16 +930,16 @@
 uilder;%0A
-
 import o
@@ -1041,217 +1041,86 @@
  %7B%0A%0A
-    @Override%0A    protected JndiRegistry createRegistry() throws Exception %7B%0A        JndiRegistry jndi = super.createRegistry();%0A        jndi.bind(%22myJacksonModule%22, new MyModule());%0A        return jndi;%0A    %7D
+%09@BindToRegistry(%22myJacksonModule%22)%0A%09private MyModule module = new MyModule();
 %0A%0A  

Use BindToRegistry wherever possible