无法进入指定的URL

时间:2018-08-02 19:08:48

标签: java http spring-boot

我有大问题。在添加另一个控制器(Worksite)之前,我可以进入以下URL:

localhost:8080/api/user/10/vacation

但是,现在,在添加一个正在监听的新控制器之后:/api/user/{id}/work-site 我无法进入localhost:8080/api/user/10/vacation

我收到此错误异常:

{
  "timestamp": "2018-08-02T19:02:40.432+0000",
  "status": 500,
  "error": "Internal Server Error",
  "message": "HHH000142: Bytecode enhancement failed: com.springproject27.springproject.user.User; nested exception is org.hibernate.HibernateException: HHH000142: Bytecode enhancement failed: com.springproject27.springproject.user.User",
  "path": "/api/user/10/vacation"
}

包含以下路径的我的控制器是:

@RestController
@RequestMapping(value = "/api/user/{userId}/vacation", produces =    "application/json")
@CrossOrigin(origins = "http://localhost:8080")
@AllArgsConstructor
@NoArgsConstructor
public class VacationController {

@Autowired
private VacationService vacationService;


@GetMapping
public List<Vacation> getVacations(@PathVariable Long userId) {
    return vacationService.findAllByUserId(userId);
}

我的VacationService,带有在控制器中使用的注释和方法:

@Transactional
@Service
@AllArgsConstructor
@NoArgsConstructor
public class VacationService {

@Autowired
private VacationRepository vacationRepository;

@Autowired
private UserRepository userRepository;

@Autowired
private UserService userService;

public List<Vacation> findAllByUserId(Long userId) {
    return vacationRepository.findByUserId(userId);
}

0 个答案:

没有答案