001/*
002 * Copyright 2002-2008 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.beans.factory.config;
018
019import org.springframework.beans.BeansException;
020
021/**
022 * Strategy interface for resolving a value through evaluating it
023 * as an expression, if applicable.
024 *
025 * <p>A raw {@link org.springframework.beans.factory.BeanFactory} does not
026 * contain a default implementation of this strategy. However,
027 * {@link org.springframework.context.ApplicationContext} implementations
028 * will provide expression support out of the box.
029 *
030 * @author Juergen Hoeller
031 * @since 3.0
032 */
033public interface BeanExpressionResolver {
034
035        /**
036         * Evaluate the given value as an expression, if applicable;
037         * return the value as-is otherwise.
038         * @param value the value to check
039         * @param evalContext the evaluation context
040         * @return the resolved value (potentially the given value as-is)
041         * @throws BeansException if evaluation failed
042         */
043        Object evaluate(String value, BeanExpressionContext evalContext) throws BeansException;
044
045}