项目设置:
我们使用创建了项目vue-cli并将依赖项添加到库中。
然后我们导入了一个使用可选链的项目( VueCurrencyInputv2.0.0 )。但是我们在执行脚本时出现以下错误serve:
error in ./node_modules/vue-currency-input/dist/index.esm.js
Module parse failed: Unexpected token (265:36)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| getMinValue() {
| let min = this.toFloat(-Number.MAX_SAFE_INTEGER);
> if (this.options.valueRange?.min !== undefined) {
| min = Math.max(this.options.valueRange?.min, this.toFloat(-Number.MAX_SAFE_INTEGER));
| }
Run Code Online (Sandbox Code Playgroud)
我读到 Webpack 4 默认不支持可选链。因此,我们添加了 Babel 插件用于可选链接。这是我们的babel.config.js文件:
module.exports = {
presets: …Run Code Online (Sandbox Code Playgroud) 我正在将 Spring Boot 项目迁移到版本 3。该项目使用异步任务和跟踪。
根据Micrometer GitHub wiki 上的文档,我们尝试像这样定义异步执行器:
@Configuration(proxyBeanMethods = false)
@EnableAsync
class EventProcessingConfig {
@Bean("eventsPublishExecutor")
fun eventsPublishExecutor(): Executor {
val executor =
object : ThreadPoolTaskExecutor() {
override fun initializeExecutor(
threadFactory: ThreadFactory,
rejectedExecutionHandler: RejectedExecutionHandler
): ExecutorService {
val executorService = super.initializeExecutor(threadFactory,
rejectedExecutionHandler)
return ContextExecutorService.wrap(executorService, ContextSnapshot::captureAll)
}
}
with(executor) {
setThreadNamePrefix("processing-events-")
setWaitForTasksToCompleteOnShutdown(true)
setAwaitTerminationSeconds(30)
initialize()
}
return executor
Run Code Online (Sandbox Code Playgroud)
然而,我们仍然失去了追踪。用下面的代码替换 bean 创建使一切按预期工作(尽管没有自定义)
return ContextExecutorService.wrap(
Executors.newSingleThreadExecutor(),
ContextSnapshot::captureAll
)
Run Code Online (Sandbox Code Playgroud)
您知道 Spring Boot 3 的第一个代码有什么问题或缺少什么吗?
asynchronous spring-boot spring-micrometer micrometer-tracing