Ho trovato questa domanda quando si cerca il modo per sfuggire correttamente nei seguenti casi (non funziona):
zendesk.ticket.subject.prefix=#{{ticket.id}}
In questo caso bisogna fuggire, altrimenti la seguente eccezione si verifica:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'createTicketService' defined in file [/Users/***]: Unsatisfied dependency expressed through constructor parameter 6; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'ticket' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public? at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ... 64 common frames omitted Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'ticket' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public? at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:164) at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1448) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1088) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ... 78 common frames omitted Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'ticket' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - maybe not public? at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:226) at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94) 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.getValue(SpelNodeImpl.java:120) at org.springframework.expression.spel.ast.InlineList.getValueInternal(InlineList.java:95) at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131) at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:297) at org.springframework.expression.common.CompositeStringExpression.getValue(CompositeStringExpression.java:105) at org.springframework.expression.common.CompositeStringExpression.getValue(CompositeStringExpression.java:42) at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:161) ... 83 common frames omitted
la/una soluzione potrebbe essere quella di utilizzare #{'#'}
il risultato finale è (WORKS):
zendesk.ticket.subject.prefix=#{'#'}{{ticket.id}}
fonte
2017-10-03 12:18:44
Poiché è java, è necessario sostituire hash ('#') con '\\ #' nel codice. Notare le doppie barre. In alternativa puoi sostituire '#' con '\\ u0023'. – Sabin