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