首页 \ 问答 \ 如何使用Spring 3.0表达式语言参数化@Scheduled(fixedDelay)?(How to parameterize @Scheduled(fixedDelay) with Spring 3.0 expression language?)

如何使用Spring 3.0表达式语言参数化@Scheduled(fixedDelay)?(How to parameterize @Scheduled(fixedDelay) with Spring 3.0 expression language?)

当使用Spring 3.0功能来注释计划的任务时,我想将fixedDelay设置为我的配置文件中的参数,而不是将其fixedDelay到我的任务类中,如当前的...

@Scheduled(fixedDelay = 5000)
public void readLog() {
        ...
}

不幸的是,似乎使用Spring表达式语言(Spel)的方式@Value返回一个String对象,而该对象又不能根据fixedDelay参数的要求自动装箱到一个较长的值。


When using the Spring 3.0 capability to annotate a scheduled task, I would like to set the fixedDelay as parameter from my configuration file, instead of hard-wiring it into my task class, like currently...

@Scheduled(fixedDelay = 5000)
public void readLog() {
        ...
}

Unfortunately it seems that with the means of the Spring Expression Language (SpEL) @Value returns a String object which in turn is not able to be auto-boxed to a long value as required by the fixedDelay parameter.


原文:https://stackoverflow.com/questions/2598712
更新时间:2022-03-19 09:03

最满意答案

尝试重新安装看守人:

npm r -g watchman 
brew update && brew upgrade
brew install watchman

如果这不能解决它,请尝试在这里发布的答案。

尝试通过以下方式重新安装libtool:

brew reinstall libtool --universal && brew unlink libtool && brew link libtool

如果无法帮助,请尝试将其彻底删除,然后重新尝试以上操作:

brew uninstall libtool


Try reinstalling watchman:

npm r -g watchman 
brew update && brew upgrade
brew install watchman

If that doesn't fix it, try the answers posted here.

Try to re-install libtool by:

brew reinstall libtool --universal && brew unlink libtool && brew link libtool

If won't help, try to remove it completely and re-try above again:

brew uninstall libtool

相关问答

更多
  • 很高兴你已经用解决方法解决了这个问题,但请允许我解释当你运行npm install redux --save时为什么react-native模块被删除。 解: 将package-lock.json移出项目文件夹(不要删除它,因为您稍后需要检查它) 运行rm -rf node_modules && npm install 检查/ node_modules和react-native现在应该在那里 运行npm install redux (npm v5会默认保存)来安装redux而不删除现有的模块 什么是pack ...
  • 无需生产节点服务器就可以运行React应用程序。 Facebook提供了一个易于使用的项目引导程序,您可以在这里阅读 也就是说,开发人员可能需要通过npm start在本地使用节点开发服务器,以及使用节点通过npm run build执行生产构建。 但是可以从npm run build获取构建输出,并从任何静态服务器提供它,并且有一个正在运行的反应应用程序。 It is absolutely possible to run a React app without a production node serv ...
  • 尝试重新安装看守人: npm r -g watchman brew update && brew upgrade brew install watchman 如果这不能解决它,请尝试在这里发布的答案。 尝试通过以下方式重新安装libtool: brew reinstall libtool --universal && brew unlink libtool && brew link libtool 如果无法帮助,请尝试将其彻底删除,然后重新尝试以上操作: brew uninstall libtool T ...
  • 我会假设你有先决条件 ,但在继续之前要仔细检查。 Homebrew,Watchman,Node 4+和Flow(可选)。 当您在Xcode中打开项目并按下构建按钮(播放?)时,它应该自动启动打包服务器。 但在你的情况下,它似乎没有。 在这种情况下,尝试在构建项目之前从项目的根目录中运行终端中的npm start 。 I'm going to assume you have the pre-requisites, but double check before moving on. Homebrew, Wat ...
  • Create-react-native-app与Expo创建一个新的项目,你可以弹出它变成一个反应本地项目(android / ios文件夹与本地代码+ src文件夹与javascript代码)。 您需要一个Xcode / Android Studio环境来运行没有Expo构建的react-native应用程序。 您无法使用Expo来运行带有自定义本机代码的React-Native应用程序。 相关链接: 从创建React本机应用程序弹出 Expo和React Native有什么区别? Create-reac ...
  • 克隆后不要这样做 react-native init MyApp prompt: Directory MyApp already exists. Continue?: (no) I am typing - yes npm install [all dependencies] react-native link 只需转到克隆的应用程序目录XYZApp并执行 npm install 和所有设置使用运行应用程序 react-native run-android after cloning Do ...
  • 你可以从第一个开始 步骤1打开终端并输入: create-react-native-app AwesomeProject 第2步一旦项目创建,它将显示选项列表:键入命令 cd AwesomeProject 步骤3添加软件包 npm install --save react-native-card-stack 步骤4运行该项目 npm start 这就是你需要做的。 现在您可以从您的博览应用程序扫描,直接在您的手机中运行该项目。 请注意,如果应用程序在运行运行npm install显示错误 You ...
  • 尝试检查package.json并查看其中的内容。 如果你发现旧版本,你可以改变它然后运行npm install或者运行npm install --save react-native@ 如果您遇到需要升级反应的错误,请运行npm install --save react@ 在我的情况下,我不得不使用这种替代方法,因为标准的(基于git)不起作用。 关于这个替代方案的更多细节以及这里的标准版本: https : //facebook.g ...
  • 您可以在终端尝试以下命令,可能会对您有所帮助。 brew卸载节点 sudo chown -R“$ USER”:admin / usr / local sudo chown -R“$ USER”:admin / Library / Caches / Homebrew brew安装节点 npm install -g create-react-native-app create-react-native-app Your_Project_Name cd Your_Project_Name npm开始 如果上述命令 ...
  • 你有守望者吗? (有关macOS依赖关系的列表,请参见此处 )。 你可以用brew install watchman安装它(假设你有自制软件 )。 Do you have watchman installed? (see here for a list of macOS dependencies). You can install it with brew install watchman (assuming you have homebrew).

相关文章

更多

最新问答

更多
  • 使用通配符获取更多servlet请求变量[重复](Get more servlet request variables using wildcards [duplicate])
  • 返回相同的集合类型,参数化不同(Returning same collection type, differently parameterised)
  • C ++朋友函数模板重载和SFINAE在clang ++,g ++,vc ++中的不同行为(C ++ 14模式)(C++ friend function template overloading and SFINAE different behaviors in clang++, g++, vc++ (C++14 mode))
  • 与paure IoT-Hub的Python paho-MQTT连接(Python paho-MQTT connection with azure IoT-Hub)
  • 编译器警告“来自不同的Objective-C类型的赋值”(Compiler warning “assignment from distinct objective-c type”)
  • C ++编译错误(在此函数中未初始化)[重复](C++ Compile Error (uninitialized in this function) [duplicate])
  • unsigned-signed下溢机制(unsigned-signed underflow mechanism)
  • 快速行查询的数据结构?(Data structure for fast line queries?)
  • 饥荒有手机安卓版的吗
  • Jquery可拖动碰撞检测错误(Jquery draggable collision detection bug)
  • sql调优是怎样来实现的?
  • 无法使占位符输入文本消失(Unable to make the placeholder input text disappear)
  • jQuery改变了两个div的CSS属性(JQuery change CSS property of two div's)
  • JDK中包含的库版本(Versions of libraries included in the JDK)
  • 请问下载的是出现ASP是什么意思
  • Firebase MLkit用于数字液晶显示器的文本识别(Firebase MLkit Text recognition for digital lcd displays)
  • 我可以在任何平台上运行C和C ++吗?(Can I run C and C++ on any platform?)
  • 让小组在C#的特定位置(get panel at specific positions in C#)
  • Nagios为通知设置了更高的间隔(Nagios set higher interval for notifications)
  • 无法向SMTP主机发送电子邮件(unable to send an email to SMTP host)
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何在.NET代码中验证全球邮政编码(How can I validate worldwide postal codes in my .NET code)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • Clojure:减少大型懒惰收集会占用内存(Clojure: Reducing large lazy collection eats up memory)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • 显示作为字符串的SVG(Showing an SVG that I have as a string)
  • 从jansson库里创建json请求的自由内存的正确方式是什么?(what is the proper way of free memory in creating json request from jansson libary?)
  • jQuery插件无法正常工作 - 它是附加的(jQuery plugin not working - it's appended)
  • 使用stat_summary自动调整ylim(Automatically adjusting ylim with stat_summary)