I\'m trying to use Spring to inject a SLF4J logger into a class like so:
@Component
public class Example {
private final Logger logger;
@Autowired
pu
To make your code more Spring aware use the InjectionPoint to define the loggers, i.e.:
@Bean
@Scope("prototype")
public Logger logger(InjectionPoint ip) {
return Logger.getLogger(ip.getMember().getDeclaringClass());
}
@Scope("prototype") is needed here to create 'logger' bean instance every time method is called.