我的rest api url就像在控制台中一样映射 [/ api / {repository}]
@RestController
@RequestMapping("/api")
public class UserprofileResource {
private final UserProfileService userProfileService;
public UserprofileResource(UserProfileService userProfileService ) {
this.userProfileService=userProfileService;
}
//create user profile
@PostMapping("/user-profiles")
public ResponseEntity<UserProfileDTO> createUserProfile(@Valid @RequestBody UserProfileDTO userProfileDTO) throws URISyntaxException {
UserProfileDTO userProfileDto=userProfileService.userProfileSave(userProfileDTO);
UserProfileDTO result = userProfileService.userProfileSave(userProfileDto);
return ResponseEntity.created(new URI("/api/user-profiles/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert("userProfile", result.getId().toString()))
.body(result);
}
}
当我触发http://localhost:8080/api/user-profiles时,我收到404错误,这是怎么回事,任何人都可以告诉我有关此问题的解决方案