NC里的upm文件,作用广泛,内外部接口的发布,aop编程,servelet编写,都需要用到。
经常组件部署不成功的原因,就是upm文件有问题,原因是很多人喜欢从系统里,复制upm文件,导致上面定义了很多没有必要的属性,其实写upm文件的时候,在定义属性的时候,只要设置是否远程,是否单例,事务模式这三个属性,就可以了。
<?xml version='1.0' encoding='UTF-8'?>
<module name="xxxx">
<public>
<component remote="true" singleton="true" tx="CMT">
<interface>xxxx</interface>
<implementation>xxxx</implementation>
</component>
</public>
</module>
要注意的是,singleton设置为true的时候有并发风险,使用成员变量时,要考虑同步。