I am learning Spring Boot and I have a strange problem.
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
@Aspect
@Component
public class HttpAspect {
private final static Logger logger = new LoggerFactory.getLogger(com.zhe.demo.aspect.HttpAspect.class);
}
When I run the program,I got this:
Error:(13, 59) java: cannot find symbol
symbol: class getLogger
location: class org.slf4j.LoggerFactory
It seems that the getLogger() method cannot be resolved.
But I had imported package org.slf4j.LoggerFactory.I found static method getLogger() in the package.
删除“新”:
private final static Logger logger = new LoggerFactory.getLogger(com.zhe.demo.aspect.HttpAspect.class);
It seems like a classpath problem. Do you have log4j jar in the classpath?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.