public class ProductsResource01 {
private final Logger log = LoggerFactory.getLogger(this.getClass());
@Autowired
private ProductsService productsService;
public void getProductsList(){
List<Products> list = productsService.getAll();
for(Products a : list){
System.out.println(a);
}
}
public static void main(String[] args) {
ProductsResource01 p01 = new ProductsResource01();
p01.getProductsList();
}
Bug信息:
Exception in thread "main" java.lang.NullPointerException
at cn.syy.otherUtils.ProductsResource01.getProductsList(ProductsResource01.java:18)
at cn.syy.otherUtils.ProductsResource01.main(ProductsResource01.java:26)