Fetch the repository succeeded.
This action will force synchronization from 捣鼓/forest, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
Maven中除了forest-core和spring外,还要加入以下依赖
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring</artifactId>
<version>1.0.0</version>
</dependency>
xmlns:forest="http://www.dtflys.com/schema/forest" xmlns:util="http://www.springframework.org/schema/util"
...
xsi:schemaLocation=" ...
http://www.dtflys.com/schema/forest
http://www.dtflys.com/schema/forest/forest-spring.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
..."
加入完成后效果如下
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:forest="http://www.dtflys.com/schema/forest"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.dtflys.com/schema/forest
http://www.dtflys.com/schema/forest/forest-spring.xsd">
...
</beans>
<forest:configuration
id="forestConfiguration"
timeout="30000"
retryCount="3"
connectTimeout="10000"
maxConnections="500"
maxRouteConnections="500">
<!-- forest变量定义 开始 -->
<forest:var name="baseUrl" value="http://www.xxx.com"/>
<forest:var name="x" value="0"/>
<forest:var name="y" value="1"/>
<!-- forest变量定义 结束 -->
</forest:configuration>
使用forest:configuration标签创建在Spring中的ForestConfiguration Bean
使用forest:var标签定义变量
注意:变量的作用域为该ForestConfiguration之下,所有跟这个配置对象绑定的Client都能访问到其下的变量,而别的ForestConfiguration下定义的变量不能访问。
<forest:client id="siteAClient" configuration="forestConfiguration" class="com.xxx.client.SiteAClient"/>
<forest:scan configuration="forestConfiguration" base-package="com.xxx.client"/>
...
@Autowired
private SiteAClient siteAClient;
...
Sign in for post a comment
Comment ( 0 )