有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

XML spring配置文件中的java转义双引号

我有一个SQL查询,我想把它放在XML spring配置文件中, 但是我遇到了格式错误,所以在这种情况下,我怎么能避开双引号呢

这是我的财产:

<authentication-manager>
       <authentication-provider>
        <jdbc-user-service data-source-ref="dataSource"
           users-by-username-query="select USERNAME as "username",PASSWORD as "password",1 as "enabled" from USER_APP where username = 'a'"
        />
       </authentication-provider>
    </authentication-manager>

I've tried the \ and it's not working !

提前谢谢


共 (1) 个答案

  1. # 1 楼答案

    试试这个

    <authentication-manager>
           <authentication-provider>
            <jdbc-user-service data-source-ref="dataSource"
               users-by-username-query="select USERNAME as &quot;username&quot;,PASSWORD as &quot;password&quot;,1 as &quot;enabled&quot; from USER_APP where username = 'a'"
            />
    </authentication-manager>