tags:

views:

15

answers:

1

Hi,

A stupid question on formatting but not able to figure out the correct negate parameter. I've the following string value which needs to be passed as a constructor arg through spring.

private final static String STRING_PATTERN = "\\<.*?>";

In spring config,

<bean class="com.test.TestBean">
<constructor-arg value="\\<.*?>" />
</bean>

As you can see, its not in the correct format. Can anyone please provide a clue ?

Thanks

A: 

Since Spring config is an XML file

  • there is no need to replace \ with \\ as in Java string literals
  • you need to replace < and > with &lt; and &gt;

So, you get

<constructor-arg value="\&lt;.*?&gt;" /> 
axtavt
Thanks for teh solution axtavt , it works perfectly
Shamik