Maven将applicationContext.xml从src / main / resources复制到target / myproject / WEB-INF(Maven copying applicationContext.xml from src/main/resources to target/myproject/WEB-INF)
目前,默认我认为,它复制到
target/myproject/WEB-INF/classes
因此在部署时不会获取上下文。
另外,我想引用服务器特定的配置文件database.properties ,我想把它放在tomcat / conf中,然后在applicationContext.xml中引用它,我该怎么做?
另外(2),我觉得这是一个相当标准和体面的方式来设置 - 如果我错了,请纠正我。
编辑服务器特定的配置文件我用户这个
<context:property-placeholder location="file:${catalina.home}/conf/database.properties" ignore-unresolvable="true" />
At the moment, the default I think, it copies to
target/myproject/WEB-INF/classes
so when deploying it does not pick up the context.
Also, i want to reference a server specific config file database.properties, I want to put it in tomcat/conf and then reference it in applicationContext.xml, how can I do this ?
Also(2), I am under the impression that this is a fairly standard and decent way to set things up - please correct me if I am wrong.
edit for the server specific config file I user this
<context:property-placeholder location="file:${catalina.home}/conf/database.properties" ignore-unresolvable="true" />
原文:https://stackoverflow.com/questions/8170773
最满意答案
基于其他答案,下面是一种使用软锁API来防止节点同时进入涉及两种状态的事务的方法:
@InitiatingFlow @StartableByRPC class AtomicFlow(val stateRefToSpend: StateRef, val stateRefToLock: StateRef) : FlowLogic<Unit>() { @Suspendable override fun call() { try { serviceHub.vaultService.softLockReserve(runId.uuid, NonEmptySet.of(stateRefToSpend, stateRefToLock)) } catch (e: StatesNotAvailableException) { logger.error("A transaction is already underway using S2.") return } val stateToSpend = serviceHub.loadState(stateRefToSpend) // Continue with transaction... } }
Building on the other answers, here's one way of using the soft-locking API to prevent a node from entering into transactions involving both states at once:
@InitiatingFlow @StartableByRPC class AtomicFlow(val stateRefToSpend: StateRef, val stateRefToLock: StateRef) : FlowLogic<Unit>() { @Suspendable override fun call() { try { serviceHub.vaultService.softLockReserve(runId.uuid, NonEmptySet.of(stateRefToSpend, stateRefToLock)) } catch (e: StatesNotAvailableException) { logger.error("A transaction is already underway using S2.") return } val stateToSpend = serviceHub.loadState(stateRefToSpend) // Continue with transaction... } }
相关问答
更多-
交易始终是原子的吗?(Are Transactions Always Atomic?)[2021-11-08]
这两点是无关的 顺序 如果插入值1到1000,则它将与WHERE和ORDER BY顺序连接,以将某些列中的这1000行限制为您。 除非有重复,否则你需要一个独特的约束 如果您依赖于IDENTITY,则无法保证: 插入的记录总是接收连续的标识值 。 原子性 所有交易都是原子的: 是否需要在事务中封装单个合并语句(使用插入,删除和更新)? SQL Server和事务中间的连接丢失 如果在没有事务的情况下执行删除语句,是否部分删除? The 2 points are unrelated Sequential If ... -
存储服务是支持节点的数据库。 保管库是该数据库中的一个表,用于跟踪与该节点相关的状态。 分类帐是一个比喻性的“全局事务日志”,它存储每个节点执行的每个事务(实际上,每个节点只能看到并存储该分类帐上的一部分事务) 存储服务是数据库的另一个名称。 保管库是该数据库中的一个表。 分类帐只是一种比喻 分类帐只是一种比喻。 存储服务存储节点已知的所有内容 是的,保险库存储已消耗和未消耗的状态。 每次记录事务时,节点都会获取相关状态并将其存储在其保管库中 存储服务包含节点已知的所有内容,包括保管库 The storag ...
-
基于其他答案,下面是一种使用软锁API来防止节点同时进入涉及两种状态的事务的方法: @InitiatingFlow @StartableByRPC class AtomicFlow(val stateRefToSpend: StateRef, val stateRefToLock: StateRef) : FlowLogic
() { @Suspendable override fun call() { try { serviceHub.va ... -
用@ConstructorForDeserialization注解你的参数化构造函数 尽管java文档提到使用注释[@CordaConstructor] - java文档需要在SerializationHelper.Kt中更新 在某些情况下,公民也应该参与共享项目。 还要确保为所有子项目添加-parmeters,例如: subprojects { tasks.withType(JavaCompile) { options.compilerArgs << '-parameters' ...
-
Corda上的资产标记(Asset tokenization on Corda)[2024-02-08]
通过令牌,我假设你指的是可替代资产(一个令牌与另一个令牌相同)。 在corda中,这是使用契约模型 - 契约定义了契约/资产行为。 对于这个例子,你可以在这里看到现金https://github.com/corda/corda/blob/master/finance/src/main/kotlin/net/corda/finance/contracts/asset/Cash.kt 。 为了证明一个党拥有令牌corda使用公证人。 每个状态(代币合同中定义的代币实例)都由公证人检查其有效性,只需简单地运行合同 ... -
这是一个SessionRejectException 。 这是因为从BroadcastTransaction收到消息的节点没有注册流来响应BroadcastTransaction 。 您需要在表单的接收节点上安装响应程序流: @InitiatedBy(BroadcastTransaction::class) class Responder(val counterpartySession: FlowSession) : FlowLogic
() { @Suspendable over ... -
是的,你不需要做任何特别的事情。 命令指定谁需要签名的PublicKeys。 州参与者指定州的分配清单。 Commands中列出的PublicKeys通常是交易中状态参与者列表中PublicKeys的子集。 请记住,交易的分发清单将是每个州中所有参与者集合的联合。 Yes, you shouldn't need to do anything special. Commands specify the PublicKeys of who needs to sign. State participants sp ...
-
.NET中的多方加密?(Multi-party encryption in .NET?)[2022-01-11]
Bouncy Castle加密库支持OpenPGP和其他一些加密库。 它在文档上有点短,但确实支持分割键。 The Bouncy Castle crypto library has support for OpenPGP and a number of others. It's a bit short on documentation, but it does support split keys. -
在声明中:原子事务是执行所需步骤的最小操作集。 所有这些必需的操作都发生(成功)或原子事务失败。 原子操作通常与事务没有任何共同之处。 据我所知,这来自硬件编程,其中一组操作(或一个)碰巧立即得到解决。 In a statement: an atomic transaction is the smallest set of operations to perform the required steps. Either all of those required operations happen(succ ...
-
Corda真的需要公证人来达成独特的共识吗?(Does Corda really require a notary to achieve uniqueness consensus?)[2021-09-21]
您需要公证人有两个原因: 恶意节点 :节点有目的地从其保管库中提取消耗状态,在另一个事务中使用它,并将事务发送给没有看到原始事务的交易对手 竞争条件 :两个节点同时建议消耗相同状态的事务 There are two reasons you need a notary: Malicious nodes: A node purposefully extracts a consumed state from its vault, consumes it in another transaction, and se ...