首页 \ 问答 \ 在spring xml配置中连接字符串(Concatenate string in spring xml configuration)

在spring xml配置中连接字符串(Concatenate string in spring xml configuration)

我需要将spring bean的字符串值连接到现有字符串,然后将其设置为另一个bean的属性:

<bean id="inet" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetClass"><value>java.net.InetAddress</value></property>
    <property name="targetMethod"><value>getLocalHost</value></property>
</bean>
<bean id="host" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject"><ref local="inet"/></property>
    <property name="targetMethod"><value>getHostName</value></property>
</bean>

此时,我在“主机”bean中拥有主机名。 我现在需要连接它并将它传递给publishedEndpointUrl属性。 像这样的东西:

<jaxws:endpoint 
    id="foo"
    publishedEndpointUrl= "http://" + host + "/Foo" 
    implementor="com.example.v1.foo"
    address="/v1/Foo"/>

这是如何使用spring xml配置完成的?


I need to concatenate the string value of a spring bean, to an existing string, and then set it as an attribute of another bean:

<bean id="inet" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetClass"><value>java.net.InetAddress</value></property>
    <property name="targetMethod"><value>getLocalHost</value></property>
</bean>
<bean id="host" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject"><ref local="inet"/></property>
    <property name="targetMethod"><value>getHostName</value></property>
</bean>

At this point, I have the hostname, in the 'host' bean. I now need to concatenate it and pass it to the publishedEndpointUrl attribute. Something like this:

<jaxws:endpoint 
    id="foo"
    publishedEndpointUrl= "http://" + host + "/Foo" 
    implementor="com.example.v1.foo"
    address="/v1/Foo"/>

How is this done using spring xml configuration?


原文:https://stackoverflow.com/questions/8235045
更新时间:2021-09-03 14:09

最满意答案

使用-g没有运行时间性能问题。 调试信息位于可执行文件的单独部分,如果您执行该文件,甚至不会加载该文件。

但是,如果你愿意,你可以分开调试信息和可执行文件(这仍然不会产生任何性能差异)。 我的Gentoo Linux以这种方式处理它,原因是将所使用的磁盘空间减到最小,这使得我可以在小型快速磁盘上拥有所有二进制文件,同时仍然可以在单独的分区中保留从未使用过的调试信息。

objcopy --only-keep-debug foo foo.debug
strip -g foo

现在你有一个foo可执行文件和一个包含调试符号的foo.debug。


There is no run time performance hit for using -g. The debug info lives in a separate section of the executable, which wont even be loaded if you execute the file.

But you can separate debug info and executables if you wish (which still won't make any performance difference). My Gentoo Linux handles it this way, the reason is simply minimizing used disk space which allows me having all binaries on a small fast disk while still keeping the debug info, which is alomst never used, in a separate partition.

objcopy --only-keep-debug foo foo.debug
strip -g foo

Now you have a foo executable and a foo.debug which contains debug symbols.

相关问答

更多
  • 使用-g没有运行时间性能问题。 调试信息位于可执行文件的单独部分,如果您执行该文件,甚至不会加载该文件。 但是,如果你愿意,你可以分开调试信息和可执行文件(这仍然不会产生任何性能差异)。 我的Gentoo Linux以这种方式处理它,原因是将所使用的磁盘空间减到最小,这使得我可以在小型快速磁盘上拥有所有二进制文件,同时仍然可以在单独的分区中保留从未使用过的调试信息。 objcopy --only-keep-debug foo foo.debug strip -g foo 现在你有一个foo可执行文件和一个 ...
  • $g++ -o client -I../ipc client.cc ../messages.o $g++ -o client -I../ipc client.cc ../messages.o
  • 你的分析是正确的。 但是,这并不紧张。 解释为什么构建一个堆是一个线性的操作是不容易的,你应该更好地阅读它。 这里可以很好地分析算法。 主要思想是在build_heap算法中,所有元素的实际heapify成本不是O(log n) 。 当heapify被调用时,运行时间取决于在进程终止之前元素可能在树中向下移动的距离。 换句话说,它取决于堆中元素的高度。 在最坏的情况下,元素可能会一直下降到叶面。 让我们逐级对待完成的工作。 在最底层,有2^(h)节点,但是我们不会在这些节点中调用heapify ,所以工作是 ...
  • 我的理解是O(1)不一定是常数; 相反,它不依赖于所考虑的变量。 因此,哈希查找可以相对于散列中的元素的数量被称为是O(1),但是不是相对于散列的数据的长度或散列中的元素的比例。 混淆的另一个因素是大O表示法描述了限制行为。 因此,对于小值N的函数f(N)可能确实显示出很大的变化,但是如果N接近无穷大的极限相对于N是恒定的,那么说O(1)仍然是正确的。 My understanding is that O(1) is not necessarily constant; rather, it is not d ...
  • 在标准化之前,有ioctl( ... FIONBIO ... )和fcntl( ... O_NDELAY ... ) ,但是这些在系统之间甚至在同一个系统中表现不一致。 例如, FIONBIO通常使用套接字和O_NDELAY来处理tty,对于像管道,fifos和设备这样的事情来说,这是很大的不一致的。 如果你不知道你有什么样的文件描述符,你必须设置两者才能确定。 但另外还没有数据可用的非阻塞读取不一致; 取决于操作系统和文件描述符的类型,读取可能返回0,或-1与errno EAGAIN,或-1与errno ...
  • 至少,如果g(n)收敛到n为正无穷大的正无穷大(如果g(n)不是很容易找到反例)。 证明草图: Prerequsites:g(n)收敛到正无穷大n为正无穷大。 o(g(n))中的f(n)表示: for every eps > 0 exists a n0 so that for all n > n0 abs(f(n)) < abs(g(n)*eps). 表格如下: 2^abs(f(n)) < 2^abs(g(n)*eps) = (2^eps)^g(n) (for n > n0). 对于eps <1: (2 ...
  • 数学证明: 如果我们想要证明f(n)* g(n)是O(n),我们必须证明存在n0和常数c例如: f(n)*g(n) < c*n for every n>n0 我们有这样一个事实,即f(n)是O(n),这意味着有c1,n1: f(n)n1 (1) 对于g,有c2,n2: g(n)n2 (2) 现在我们有了,对于每一个n>max(n1,n2) (最大,因为我们想要f和g的不等式): f(n)g(n)
  • f∈O(g)基本上说 对于常数k> 0的至少一个选择,可以找到一个常数a,使得对于所有x> a,不等式0 <= f(x)<= kg(x)。 请注意,O(g)是此条件成立的所有函数的集合。 f∈o(g)基本上说 对于常数k> 0的每一个选择,你可以找到一个常数a,使得对于所有x> a,不等式0 <= f(x)
  • 似乎g ++在将它们用作模板参数之前扩展了typedef,但是在将它们与前者进行比较时,无法扩展未用作模板参数的typedef。 更简单的代码版本说明了这一点: #include typedef unsigned int uint32_t; template class Foo { public : template void fun(C* c, void (C::*f)(T)) { ...
  • 问题出在特征库中。 你不想find_package( Eigen) ,只需将EIGEN_INCLUDE_DIRS设置为你已经解压缩Eigen的路径。 另外,从target_link_libraries删除Eigen库。 Eigen是一个只有标头的库,包括它的标题就足够了。 更新:Eigen还在cmake子目录中提供FindEigen3.cmake文件。 您可以将此文件复制到源,并将路径添加到CMAKE_MODULE_PATH The problem is in the Eigen library. You ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)