1 package org.codehaus.plexus.spring;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
24 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
25 import org.springframework.core.NestedRuntimeException;
27 import com.opensymphony.webwork.spring.WebWorkSpringObjectFactory;
28 import com.opensymphony.xwork.Action;
29 import com.opensymphony.xwork.Result;
30 import com.opensymphony.xwork.interceptor.Interceptor;
33 * Replacement for WebWorkSpringObjectFactory ("webwork.objectFactory = spring") to support
34 * plexus components lookup as expected by plexus-xwork integration.
36 * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
38 public class WebWorkPlexusInSpringObjectFactory
39 extends WebWorkSpringObjectFactory
45 * @see com.opensymphony.xwork.spring.SpringObjectFactory#buildBean(java.lang.String,
48 public Object buildBean( String name, Map map )
51 String id = PlexusToSpringUtils.buildSpringId( Action.class, name );
52 if ( appContext.containsBean( id ) )
54 return super.buildBean( id, map );
57 id = PlexusToSpringUtils.buildSpringId( Result.class, name );
58 if ( appContext.containsBean( id ) )
60 return super.buildBean( id, map );
63 id = PlexusToSpringUtils.buildSpringId( Interceptor.class, name );
64 if ( appContext.containsBean( id ) )
66 return super.buildBean( id, map );
68 return super.buildBean( name, map );