报错信息:
严重: Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException
原因:导包导错了!
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jdk.nashorn.internal.ir.annotations.Reference;
@RestController
@RequestMapping("/specification")
public class SpecificationController {
@Reference
private SpecificationService specificationService;
}
上图中的注解@Reference导包错误!错误包:
import jdk.nashorn.internal.ir.annotations.Reference;
正确包:
import com.alibaba.dubbo.config.annotation.Reference;