我正在开发一个jhipster应用程序。编译时,出现了一系列与找不到符号有关的错误。
我尝试查看堆栈跟踪,并在注释掉某些行后重新运行了代码。这是导致错误的代码段:
@RequestMapping("/api")
public class PhotoResource {
private final Logger log = LoggerFactory.getLogger(PhotoResource.class);
private static final String ENTITY_NAME = "photo";
private final PhotoRepository photoRepository;
public PhotoResource(PhotoRepository photoRepository) {
this.photoRepository = photoRepository;
}
/**
* POST /photos : Create a new photo.
*
* @param photo the photo to create
* @return the ResponseEntity with status 201 (Created) and with body the new photo, or with status 400 (Bad Request) if the photo has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/photos")
@Timed
public ResponseEntity<Photo> createPhoto(@Valid @RequestBody Photo photo) throws Exception {
log.debug("REST request to save Photo : {}", photo);
if (photo.getId() != null) {
throw new BadRequestAlertException("A new photo cannot already have an ID", ENTITY_NAME, "idexists");
}
try {
photo = setMetadata(photo);
} catch (ImageProcessingException ipe) {
log.error(ipe.getMessage());
}
Photo result = photoRepository.save(photo);
return ResponseEntity.created(new URI("/api/photos/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
我得到的错误如下:
[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[50,19] cannot find symbol
[ERROR] symbol: class PhotoRepository
[ERROR] location: class com.okta.developer.web.rest.PhotoResource
[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[52,26] cannot find symbol
[ERROR] symbol: class PhotoRepository
[ERROR] location: class com.okta.developer.web.rest.PhotoResource
[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[65,66] cannot find symbol
[ERROR] symbol: class Photo
[ERROR] location: class com.okta.developer.web.rest.PhotoResource
[ERROR] /home/nompumelelo/Desktop/gallery/src/main/java/io/github/jhipster/application/web/rest/PhotoResource.java:[65,27] cannot find symbol
[ERROR] symbol: class Photo
[ERROR] location: class com.okta.developer.web.rest.PhotoResource