1
在Spring Webflow流中使用嘲讽Spring Bean有明确的指导原则。 Flow默认默认从流中引用Spring Beans,而AbstractXmlFlowExecutionTests基本测试类有一个方法来覆盖以模拟这些bean。Spring Webflow 2.3测试:如何模拟流变量的@Autowired字段
我找不到类似的方法来模拟被测流中流变量的@Autowired字段。请参阅以下基本设置以了解我的意思。
流量测试:
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
parent="commons">
<var name="consumerBean" class="com.mycompany.ConsumerBean" />
<!-- etc.. -->
豆与@Autowired领域:
public class ConsumerBean implements Serializable {
@Autowired
transient CustomerService userService;
//Etc..
所以我的问题是,如何提供/配置 'userService' 的模拟来'consumerBean'流变量?