Spring config string format
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开发者_Go百科 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
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<
and>
So, you get
<constructor-arg value="\<.*?>" />
精彩评论