title: Conditionally create bean if Map of properties is not empty with SpEL
body: <p>I have a class with a method that is periodically invoked with the <code>@Scheduled</code> annotation. The method does some bulk operations on a given set of properties.
  If there are no properties set, I don't need the scheduled method invocation nor the instantiated class. Therefore, I've added this <code>SpEL</code> expression to check whether the properties are set:</p>
  
  <pre><code>@Service
  @ConditionalOnExpression("#(T(java.util.Map)('${myproperties.people:{:}}')).size() &gt; 0")
  public class PeopleService { ... }
  </code></pre>
  
  <p>Example values in the <code>application.yml</code> could be:</p>
  
  <pre><code>myproperties:
    people:
      uuid1:
        name: Mark
        age: 32
      uuid2:
        name: Jeff
        age: 36
  </code></pre>
  
  <p>Unfortunately I get this error message:</p>
  
  <pre><code>Caused by: org.springframework.expression.spel.SpelParseException: Expression [#(T(java.util.Map)('{:}')).size() &gt; 0] @1: EL1043E: Unexpected token. Expected 'identifier' but was 'lparen(()'
  </code></pre>
  
  <p>Note that I came up with <code>{:}</code> for an empty map as default value here: <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions-inline-maps" rel="nofollow noreferrer">https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions-inline-maps</a> </p>
  
  <p>If I use this SpEL, I get the following error: <code>"#(T(java.util.Map)(${myproperties.people:})).size() &gt; 0"</code></p>
  
  <pre><code>Caused by: org.springframework.expression.spel.SpelParseException: Expression [#(T(java.util.Map)()).size() &gt; 0] @1: EL1043E: Unexpected token. Expected 'identifier' but was 'lparen(()'
  </code></pre>
  
  <p>What is the correct way to accomplish this?</p>