title: SPEL expression does not work with #{#entityName} in @Query
body: <p>The following queries work:</p>
  
  <pre><code>@Query("select o from Employee o where o.tenant.id = ?#{context.tenantId}")
  
  @Query("select o from #{#entityName} o where o.tenant.id = 1")
  </code></pre>
  
  <p>But if I use both expressions together an exception is thrown at the startup.</p>
  
  <pre><code>@Query("select o from #{#entityName} o where o.tenant.id = ?#{context.tenantId}")
  </code></pre>
  
  <p>Exception stack trace:</p>
  
  <pre><code>Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'context' cannot be found on null
  at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:222)
  at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:93)
  at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:81)
  at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:51)
  at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87)
  at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
  at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299)
  at org.springframework.expression.common.CompositeStringExpression.getValue(CompositeStringExpression.java:89)
  at org.springframework.expression.common.CompositeStringExpression.getValue(CompositeStringExpression.java:136)
  at org.springframework.data.jpa.repository.query.ExpressionBasedStringQuery.renderQueryIfExpressionOrReturnQuery(ExpressionBasedStringQuery.java:71)
  at org.springframework.data.jpa.repository.query.ExpressionBasedStringQuery.&lt;init&gt;(ExpressionBasedStringQuery.java:48)
  at org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery.&lt;init&gt;(AbstractStringBasedJpaQuery.java:57)
  at org.springframework.data.jpa.repository.query.SimpleJpaQuery.&lt;init&gt;(SimpleJpaQuery.java:55)
  at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:70)
  at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:51)
  at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:137)
  at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:202)
  at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:80)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.&lt;init&gt;(RepositoryFactorySupport.java:357)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:192)
  at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239)
  at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225)
  at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)
  </code></pre>
  
  <p>Am I doing something wrong or is this a bug? Tested with spring-data-jpa 1.7.1 and 1.8.0-snapshot.</p>