Comment puis-je échapper des valeurs dans SPEL?
Question
Je suis en train d'écrire quelques déclarations de Spel en XML, et je ne peux pas obtenir l'analyseur pour déterminer le moment où je dois échapper un caractère.
J'ai essayé ce qui suit:
<... property="someProperty" value="#{ someBean.aMethodOnTheBean('st\'ring') }" />
Cependant, les ajouter dans le répertoire \ » ne semble pas échapper à cette seule citation et je continue à recevoir une exception de l'analyseur.
Y at-il moyen d'échapper à ces valeurs?
Autres conseils
I modifié à:
.... value="#{ someBean.aMethodOnTheBean("st'ring") }"
Cela fonctionne, je me suis souvenu à tort que j'ai eu des problèmes lors de l'utilisation d'une double citation à l'entrée d'une valeur de chaîne en fonction Spel avant.
Voici la définition du schéma:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
default-lazy-init="true"
default-init-method="initialize">
Le XML valide correctement dans Eclipse. Cependant mon exemple simplifié n'était pas valide - mes excuses et bonne prise. Je suis en train de réellement la valeur comme ceci:
<bean id="someBean" class="someClass">
<property name="someList">
<list>
<value>"#{ anotherBean.methodOnBean("some'String") }"</value>
</list>
</property>
</bean>
FWIW, Spel a un support pour les guillemets doubles, comme la version 3.2. -9620 SPR