만약 평가 context가 빈 리졸버와 configure된다면 심볼을 사용해서 빈을 찾을 수 있다. 아래는 어떻게 하는지를 보여주는 예제이다.
ExpressionParser parser =newSpelExpressionParser();StandardEvaluationContext context =newStandardEvaluationContext();context.setBeanResolver(newMyBeanResolver());// This will end up calling resolve(context,"something") on MyBeanResolver during evaluationObject bean =parser.parseExpression("@something").getValue(context);
팩토리 빈에 접근하기 위해 &심볼로 prefix를 대신해야한다. 아래는 어떻게 하는지를 보여주는 예제이다.
ExpressionParser parser =newSpelExpressionParser();StandardEvaluationContext context =newStandardEvaluationContext();context.setBeanResolver(newMyBeanResolver());// This will end up calling resolve(context,"&foo") on MyBeanResolver during evaluationObject bean =parser.parseExpression("&foo").getValue(context);