001/*
002 * Copyright 2002-2012 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.servlet.view.tiles3;
018
019import org.apache.tiles.TilesException;
020import org.apache.tiles.preparer.ViewPreparer;
021
022import org.springframework.web.context.WebApplicationContext;
023
024/**
025 * Tiles {@link org.apache.tiles.preparer.PreparerFactory} implementation
026 * that expects preparer bean names and obtains preparer beans from the
027 * Spring ApplicationContext. The full bean creation process will be in
028 * the control of the Spring application context in this case, allowing
029 * for the use of scoped beans etc.
030 *
031 * @author Juergen Hoeller
032 * @since 3.2
033 * @see SimpleSpringPreparerFactory
034 */
035public class SpringBeanPreparerFactory extends AbstractSpringPreparerFactory {
036
037        @Override
038        protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException {
039                return context.getBean(name, ViewPreparer.class);
040        }
041
042}