code: private boolean isInValidScope(FacesContext facesContext, ManagedProperty property, ManagedBean beanConfiguration)
      {
          if (!property.isValueReference())
          {
              // no value reference but a literal value -> nothing to check
              return true;
          }
          
          // get the targetScope (since 2.0 this could be an EL ValueExpression)
          String targetScope = null;
          if (beanConfiguration.isManagedBeanScopeValueExpression())
          {
              // the scope is a custom scope
              // Spec says, that the developer has to take care about the references
              // to and from managed-beans in custom scopes.
              // However, we do check the references, if we are not in Production stage
              if (facesContext.isProjectStage(ProjectStage.Production))
              {
                  return true;
              }
              else
              {
                  targetScope = getNarrowestScope(facesContext, 
                                                  beanConfiguration
                                                      .getManagedBeanScopeValueExpression(facesContext)
                                                      .getExpressionString());
                  // if we could not obtain a targetScope, return true
                  if (targetScope == null)
                  {
                      return true;
                  }
              }
          }
          else
          {
              targetScope = beanConfiguration.getManagedBeanScope();
              if (targetScope == null)
              {
                  targetScope = NONE;
              }
          }
          
          // optimization: 'request' scope can reference any value scope
          if (targetScope.equalsIgnoreCase(REQUEST))
          {
              return true;
          }
          
          String valueScope = getNarrowestScope(facesContext, 
                                                property.getValueBinding(facesContext)
                                                    .getExpressionString());
          
          // if we could not obtain a valueScope, return true
          if (valueScope == null)
          {
              return true;
          }
          
          // the target scope needs to have a shorter (or equal) lifetime than the value scope
          return (SCOPE_COMPARATOR.compare(targetScope, valueScope) <= 0);
      }
docs: Checks if the scope of the property value is valid for a bean to be stored in targetScope.
  If one of the scopes is a custom scope (since jsf 2.0), this method only checks the
  references if the current ProjectStage is not Production.
  @param facesContext
  @param property           the property to be checked
  @param beanConfiguration  the ManagedBean, which will be created