错误描述
大家好,
我无法从基于 JHipster 的项目中手动添加的控制器获得响应。我搭建了最初的项目,然后亲手编写了自己的服务和控制器。
当我执行调用时,我从 SoapUI(我用于初始验证)获得的错误结果位于以下 url:http: //imgur.com/04FpmEZ,Havk1EL#0
如果我查看我的Eclipse 控制台错误,我会看到以下内容:http: //imgur.com/04FpmEZ,Havk1EL#1
控制器
/**
* GET /courses/json -> get all the courses.
*/
@RequestMapping(value = "/json",
method = RequestMethod.GET,
produces = "application/json")
@Timed
public List<Course> getAll() {
log.debug("REST request to get all Courses");
return courseService.findAllCourses();
}
服务
package com.testapp.myapp.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.testapp.myapp.domain.Course;
import com.testapp.myapp.repository.CourseRepository;
@Service
@Transactional
public class CourseServiceImpl implements CourseService {
@Autowired
CourseRepository courseRepository;
public long countAllCourses() {
return courseRepository.count();
}
public void deleteCourse(Course course) {
courseRepository.delete(course);
}
public Course findCourse(Integer id) {
return courseRepository.findOne(id);
}
public List<Course> findAllCourses() {
return courseRepository.findAll();
}
public List<Course> findCourseEntries(int firstResult, int maxResults) {
return courseRepository.findAll(new org.springframework.data.domain.PageRequest(firstResult / maxResults, maxResults)).getContent();
}
public void saveCourse(Course course) {
courseRepository.save(course);
}
public Course updateCourse(Course course) {
return courseRepository.save(course);
}
}
令人困惑的是,我直接针对我的数据库运行了 hibernate 提供的查询,它返回的记录集就好了。由于 JHipster 自动加载的某些安全或身份验证约束,服务是否可能被阻止?