且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 Spring Boot 将依赖注入到 Logback Appenders

更新时间:2022-12-18 11:26:09

无法执行您正在尝试执行的操作.Logback 在创建应用程序上下文之前初始化,因此不需要执行依赖注入.

It isn't possible to do what you are trying to do. Logback is initialised before the application context is created so there's nothing to perform the dependency injection.

也许您可以问另一个问题来描述您希望 appender 能够做什么?可能有一种解决方案不涉及将 Spring 管理的 bean 注入其中.

Perhaps you could ask another question describing what you'd like your appender to be able to do? There may be a solution that doesn't involve injecting Spring-managed beans into it.