我想使用Spring Integration RedisLockRegistry
。我对Spring Integration RedisLockRegistry
有一些疑问。
我可以将redisLockRegistry
用作Spring bean吗?这意味着我的应用程序只需一个redisLockRegistry
。
我在版本5.0中看到RedisLockRegistry
工具ExpirableLockRegistry
,
我是否需要运行expireUnusedOlderThan
方法?
答案 0 :(得分:1)
我遇到了同样的问题并开始分析弹簧代码。所以从我的来源我可以说:
是的,您可以创建并将其配置为LockRegistry
RedisLockRegistry
的任何实例的bean,例如JdbcLockRegistry
,PassThruLockRegistry
。出于测试目的,我甚至想使用expireUnusedOlderThan
我试图在Spring中找到@Autowired
private ExpirableLockRegistry lockRegistry;
@Scheduled(fixedDelay=50000)
public void cleanObsolete(){
lockRegistry.expireUnusedOlderThan(50000);
}
的任何调用但没有成功。
所以我创建了如下简单的调度程序:
<UserControl
x:Class="UniversalProject.UWP.Controls.TabHeader"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UniversalProject.UWP.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Width="64" Height="68" IsTabStop="False"
d:DesignHeight="300"
d:DesignWidth="400">
<StackPanel >
<FontIcon
HorizontalAlignment="Center"
Margin="0,12,0,0"
Glyph="{Binding Glyph}"
FontSize="16" />
<TextBlock
FontFamily="Segoe UI"
Text="{Binding Label}"
Style="{StaticResource CaptionTextBlockStyle}"
LineStackingStrategy="BlockLineHeight"
LineHeight="14"
MaxLines="2"
IsTextScaleFactorEnabled="False"
TextAlignment="Center"
HorizontalAlignment="Center"
Margin="2,5,2,7" />
</StackPanel>