I am new to Spring boot. I have a MYSQL table "customer" with data as shown:
Data in the table When testing the API output using Postman, there seems to be rows of empty JSON output.
API Output
Below is my code:
package com.semika.customer;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="customer")
public class Customer {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#Column(name="first_name")
private String firstName;
#Column(name="last_name")
private String lastName;
#Column(name="address")
private String address;
public Customer() {
super();
}
}
CustomerRepository
package com.semika.customer;
import org.springframework.data.repository.CrudRepository;
public interface CustomerRepository extends CrudRepository<Customer, Long>{
}
CustomerService
package com.semika.customer;
public interface CustomerService {
public Iterable<Customer> findAll();
}
CustomerServiceImpl
package com.semika.customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
#Service
public class CustomerServiceImpl implements CustomerService{
#Autowired
private CustomerRepository customerRepository;
public Iterable<Customer> findAll() {
return customerRepository.findAll();
}
}
CustomerController
package com.semika.customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class CustomerController {
#Autowired
private CustomerService customerService;
#RequestMapping("/customers")
#ResponseBody
public Iterable<Customer> findAll() {
Iterable<Customer> customers = customerService.findAll();
return customers;
}
}
I don't know what else I need to modify in the controller to be able to see the output with data.
At first look your code seems fine. So, I copied your code and try to run it and got an empty response just like you. After spending some time I figured out the reason why.
Use getter and setter in you customer class and recompile the code.
It will solve your problem. Also do the following changes:
1) Annotate CustomerRepository with #Repository
2) use #EnableJpaRepositories("package path") in your application's main class if your repository is not in the same or sub package.
3) use method type or #GetMapping annotation in your controller.
For your convenience I am writing your code after all the modifications:
TestDemoApplication.java
package testdemo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
#SpringBootApplication
#EnableJpaRepositories("put repository path here")
public class TestDemoApplication {
public static void main(String[] args) {
SpringApplication.run(TestDemoApplication.class, args);
}
}
CustomerServiceImpl.java
package testdemo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
#Service
public class CustomerServiceImpl implements CustomerService{
#Autowired
private CustomerRepository customerRepository;
public Iterable<Customer> findAll() {
return customerRepository.findAll();
}
}
CustomerService.java
package testdemo;
public interface CustomerService {
public Iterable<Customer> findAll();
}
CustomerRepository.java
package testdemo;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
#Repository
public interface CustomerRepository extends CrudRepository<Customer, Long>{
}
CustomerController.java
package testdemo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class CustomerController {
#Autowired
private CustomerService customerService;
#GetMapping(value = "/customers")
public Iterable<Customer> findAll() {
Iterable<Customer> customers = customerService.findAll();
return customers;
}
}
Customer.java
package testdemo;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="customer")
public class Customer {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
#Column(name="first_name")
private String firstName;
#Column(name="last_name")
private String lastName;
#Column(name="address")
private String address;
public Customer() {
super();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
Also, CrudRepository returns a Iterable<> in findAll(). It is the JpaRepository which returns List<> so, no worries about it.
You may need to iterate over the dataset and add the results to a List or as Vishal stated, change your interfaces and implementations to return a List rather than an Iterable.
package com.semika.customer;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
#RestController
public class CustomerController {
#Autowired
private CustomerService customerService;
#RequestMapping("/customers")
#ResponseBody
public Iterable<Customer> findAll() {
List<Customer> results = new ArrayList<>();
Iterator<Customer> iter = customerService.findAll().iterator();
while (iter.hasNext()) results.add(iter.next());
return results;
}
}
In the following post, Andy states,
While a List is guaranteed to be an Iterable an Iterable may not be a List. This means that if you do cast an Iterable to a List it may fail at runtime. Even if it works, there's no guarantee that it will continue to work in the future as it could change in new versions of Spring Data JPA without breaking the interface's contract.
Instead of using a cast, you should declare your own query methods that return List.
Also noted in that post, you can use JpaRepository rather than CrudRepository because JPA will return a List rather than an Iterable as mentioned here.
Related
Hey I am pretty new to using the Spring Framework and was just trying to get an application to work for practice but I am getting the following error in my stack trace:
Cannot invoke "com.gabriel.schoolapp.repository.UsersRepo.findAll()" because "this.usersRepo" is null
This is my model layer for the Users:
package com.gabriel.schoolapp.models;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
#NoArgsConstructor
#AllArgsConstructor
#Getter
#Setter
#ToString
#Entity
#Table(name = "users")
public class Users {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer usersID;
#Column(nullable = false)
private String firstName;
public void FirstName(String firstName){
this.firstName = firstName;
}
#Column(nullable = false)
private String lastName;
public void ClassDesc(String lastName){
this.lastName = lastName;
}
#Column(nullable = false)
private String username;
public void Username(String username){
this.username = username;
}
}
This is my repository layer:
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.gabriel.schoolapp.models.Users;
#Repository
public interface UsersRepo extends JpaRepository<Users, Integer>{
Users findByUsername(String firstName);
}
And this is my service layer:
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gabriel.schoolapp.models.Users;
import com.gabriel.schoolapp.repository.UsersRepo;
#Service
public class UsersService {
#Autowired
private UsersRepo usersRepo;
#Autowired
public UsersService(UsersRepo usersRepo){
this.usersRepo = usersRepo;
}
public UsersService(){
}
public Users createUser(Users user){
Users checkIfUserInDb = usersRepo.findByUsername(user.getFirstName());
if(checkIfUserInDb != null){
System.out.println("Username already in DB");
return null;
}
System.out.println("User is valid");
return usersRepo.save(user);
}
public List<Users> getAllUsersById(){
return this.usersRepo.findAll();
}
}
Whenever I try to call a method from the service layer like so:
#SpringBootApplication
public class SchoolAppApplication {
public static void main(String[] args) {
SpringApplication.run(SchoolAppApplication.class, args);
UsersService serv = new UsersService();
serv.getAllUsersById();
}
}
It returns with the aforementioned error (this.usersRepo is null)
Any help would be greatly appreciated thank you!!
The UserService you created is not managed by Spring, hence the repo is not autowired. You need a few things:
implement CommandLineRunner in SchoolAppApplication
Autowire your service in SchoolAppApplication
Override method run in SchoolAppApplication and run your service there:
#Override
public void run(String... args) {
serv.getAllUsersById();
}
I'm new to REST APIs and Spring Boot. I have been trying to create the REST APIs using STS and MySQL that stores Employees data.
Everything seems fine but when I POST the data in Postman, empty rows are storing in the MySQL and body.
Somebody please help me.
//My employee class in the model
package com.example.SpringBootApplicationProject.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
//We need to make this simple Employee class to JPA annotation
#Data
#Entity
#Table(name="employees")
public class Employee {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
#Column(name = "first_name")
private String firstName;
#Column(name = "last_name")
private String lastName;
#Column(name = "email")
private String email;
#Column(name = "salary")
private long salary;
}
//Employee Controller Class
package com.example.SpringBootApplicationProject.controller;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.SpringBootApplicationProject.model.Employee;
import com.example.SpringBootApplicationProject.service.EmployeeService;
#RestController
#RequestMapping("/api/employees")
public class EmployeeController {
private EmployeeService employeeService;
public EmployeeController(EmployeeService employeeService) {
super();
this.employeeService = employeeService;
}
//Build employee REST API
#PostMapping
public ResponseEntity<Employee> saveEmployee(#RequestBody Employee employee){
return new ResponseEntity<Employee>(employeeService.saveEmployee(employee), HttpStatus.CREATED);
}
}
//Employee Repository class
package com.example.SpringBootApplicationProject.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.SpringBootApplicationProject.model.Employee;
//This is an interface.
//JPA repository automatically provides #Repository
public interface EmployeeRepository extends JpaRepository<Employee, Long>{
//public interface EmployeeRepository extends JpaRepository<Employee, Long>{
//Employee save(Employee employee);
}
//Employee Service Class
package com.example.SpringBootApplicationProject.service;
import com.example.SpringBootApplicationProject.model.Employee;
public interface EmployeeService
{
Employee saveEmployee(Employee employee);
}
//Employee Service Impl
package com.example.SpringBootApplicationProject.service.impl;
import org.springframework.stereotype.Service;
import com.example.SpringBootApplicationProject.model.Employee;
import com.example.SpringBootApplicationProject.repository.EmployeeRepository;
import com.example.SpringBootApplicationProject.service.EmployeeService;
#Service
public class EmployeeServiceImpl implements EmployeeService{
private EmployeeRepository employeeRepository;
public EmployeeServiceImpl(EmployeeRepository employeeRepository) {
super();
this.employeeRepository = employeeRepository;
}
#Override
public Employee saveEmployee(Employee employee) {
return employeeRepository.save(employee);
}
}
Postman blank data[MySQL Empty DB][1]
I am new to Spring Boot Framework without any prior knowledge of the Spring Framework. I encountered this error when I am running the spring application:
The error points to the service class
PersonService.java
package com.example.demo1.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.example.demo1.dao.PersonDao;
import com.example.demo1.model.Person;
#Service
public class PersonService {
private final PersonDao personDao;
// The #Autowired means that we are injecting in actual constructor. It means we are autowiring in the PersonDao interface
// We have multiple implementation of the PersonDao interface. So to distinguish between them we use the #Qualifier
#Autowired
public PersonService(#Qualifier("fake") PersonDao personDao) {
this.personDao = personDao;
}
// Here we have the option of providing the id or not
public int addPerson(Person person) {
return personDao.insertPerson(person);
}
}
The error shows that the bean of the type PersonDao is required that could not be found. But I could not identify how to create the bean. I have used the dependency injection for the PersonDao class.
PersonDao.java
package com.example.demo1.dao;
import java.util.UUID;
import com.example.demo1.model.Person;
public interface PersonDao {
int insertPerson(UUID id, Person person);
default int insertPerson(Person person) {
UUID id = UUID.randomUUID();
return insertPerson(id, person);
}
}
FakePersonDataAccessService
package com.example.demo1.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.springframework.stereotype.Repository;
import com.example.demo1.model.Person;
// The #Repository annotation means that this class is served as a Repository
#Repository("fakeDao")
public class FakePersonDataAccessService implements PersonDao {
private static List<Person> DB = new ArrayList<>();
#Override
public int insertPerson(UUID id, Person person) {
DB.add(new Person(id, person.getName()));
return 1;
}
}
Person.java
package com.example.demo1.model;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Person {
private final UUID id;
private final String name;
public Person(#JsonProperty("id") UUID id,
#JsonProperty("name") String name) {
this.id = id;
this.name = name;
}
public UUID getId() {
return id;
}
public String getName() {
return name;
}
}
PersonController.java
package com.example.demo1.api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo1.model.Person;
import com.example.demo1.service.PersonService;
// We can implement the http methods(get, put, post, delete) implementation in the controller. We can do that by using the #RestController annotation
#RequestMapping("/api/v1/person")
#RestController
public class PersonController {
private final PersonService personService;
// The #Autowired means that the spring boot injects actual service in the constructor
#Autowired
public PersonController(PersonService personService) {
this.personService = personService;
}
// The #RequestBody annotation shows that we convert the json body that we receive from the postman to an actual Person
#PostMapping
public void addPerson(#RequestBody Person person) {
personService.addPerson(person);
}
}
I am building simple ManyToOne relationship using spring JAP. i get UnsatisfiedDependencyException Error with bean name Unsatisfied dependency expressed through field
UnsatisfiedDependencyException: Error creating bean with name 'procjectController': Unsatisfied
Here is my file.
project.java
package com.ganesh.dto;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.fasterxml.jackson.annotation.JsonIgnore;
#Entity
public class Project {
#Id
private int projectId;
private String projectName;
//Relation establish
#ManyToOne(
fetch = FetchType.LAZY,
optional = false
)
#JoinColumn(
name = "employee_id",
nullable = false
)
#JsonIgnore
private Employee employee;
public Project() {
}
public Project(int projectId, String projectName, int eId) {
super();
this.projectId = projectId;
this.projectName = projectName;
//Adding employee
this.employee = new Employee(eId,"","");
}
public int getProjectId() {
return projectId;
}
public void setProjectId(int projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
//Adding getter and setters Employee reference
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
}
ProjectDao.java
package com.ganesh.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.ganesh.dto.Project;
#Repository
public interface ProjectDao extends JpaRepository<Project, Integer> {
List<Project> findEmployeeById(int eId);
}
ImpProjectService.java
package com.ganesh.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ganesh.dao.*;
import com.ganesh.dto.Project;
#Service
public class ImpProjectService implements ProjectService {
#Autowired
private ProjectDao projectDao;
#Override
public List<Project> getProjectList(int eId) {
System.out.println("in Dao class employee id"+ eId);
return projectDao.findEmployeeById(eId);
}
#Override
public Project getProjectById(int id) {
return projectDao.getOne(id);
}
#Override
public void addProject(Project project) {
projectDao.save(project);
}
#Override
public void updateProject(Project project) {
projectDao.save(project);
}
#Override
public void deleteProjectById(int id) {
projectDao.deleteById(id);
}
#Override
public List<Project> getAllProject() {
return projectDao.findAll();
}
}
ProcjectController.java
package com.ganesh.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ganesh.dto.*;
import com.ganesh.service.*;
#RestController
public class ProcjectController {
#Autowired
private ImpProjectService projectService;
#RequestMapping("/projects")
public List<Project> getProjectList(){
return projectService.getAllProject();
}
#RequestMapping("/employees/{eId}/projects")
public List<Project> getAllProjects(#PathVariable int eId){
System.out.println("In Project Controller");
List<Project> projList = projectService.getProjectList(eId);
System.out.println(projList);
return projList;
}
#RequestMapping("/employees/{eId}/projects/{id}")
public Project getProjectById(#PathVariable int id) {
return projectService.getProjectById(id);
}
#RequestMapping(method = RequestMethod.POST, value="/employees/{eId}/projects")
public void addProject(#RequestBody Project project, #PathVariable int eId) {
project.setEmployee(new Employee(eId,"",""));
projectService.addProject(project);
}
#RequestMapping(method = RequestMethod.PUT, value="/employees/{eId}/projects/{id}")
public void updateProject(#RequestBody Project project, #PathVariable int eId) {
project.setEmployee(new Employee(eId,"",""));
projectService.updateProject(project);
}
#RequestMapping(method = RequestMethod.DELETE, value="/projects/{id}")
public void deleteProjecstById(#PathVariable int id) {
projectService.deleteProjectById(id);
}
}
Note: This answer is based on insufficient data, because stack trace is not available. With correct and complete stacktrace, we might be able to provide more precise answer.
Answer:
Looks like a problem in your Dao class.
You have written
#Repository
public interface ProjectDao extends JpaRepository<Project, Integer> {
List<Project> findEmployeeById(int eId);
}
Which means you are creating a repository of type Project and trying to fire a query as findEmployeeById, It should either be findByEmployee, which accepts Employee as a parameter, or should not be there in place at all. Because the query syntax and the Template parameters do not match. So Spring will not be able to initialize the query handlers for the same.
Try changing it as below, if is satisfies your purpose.
#Repository
public interface ProjectDao extends JpaRepository {
List<Project> findAllByEmployee(Employee emp);
}
Please check the same, and correct. If it still doesn't work, please post the full stack trace, and we can help you out.
I'm using Spring and JpaRepository as data access layer. I have my #Repository interface as below:
#Repository
interface EventRepository extends JpaRepository<Event, Long>, JpaSpecificationExecutor<Event> {
.... some custom methods irrelevant to this post ....
}
Here's my simplified model classes:
class Event {
Long eventID;
String name;
Date time;
Zone zone;
}
class Zone {
Long zoneId;
String zoneName;
User user;
}
class User {
Long userId;
String username;
}
I'm using there JpaSpecificationExecutor to fetch database for list of Events in specific time. I'm using this method and it work correctly:
Page<T> findAll(Specification<T> spec, Pageable pageable);
But I want to add another condition to fetch entries only for specific User.
I tried to create new method like this:
Page<Event> findAllByZone_User(User user, Specification<Event> spec, Pageable pageable);
But when I call it I get in this line Exception:
java.util.NoSuchElementException: null
Is it even possible to create such method? If not - how should I proceed?
I have created a Spring boot project like yours and this is working for me. You can check my code below.....
Event.java
package com.example.model;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
#Entity
public class Event {
#Id
#GeneratedValue(strategy=GenerationType.AUTO)
private Long eventID;
private String name;
private Date time = new Date();
#OneToOne(cascade = CascadeType.ALL)
private Zone zone;
public Long getEventID() {
return eventID;
}
public void setEventID(Long eventID) {
this.eventID = eventID;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public Zone getZone() {
return zone;
}
public void setZone(Zone zone) {
this.zone = zone;
}
}
Zone.java
package com.example.model;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
#Entity
public class Zone {
#Id
#GeneratedValue(strategy=GenerationType.AUTO)
private Long zoneId;
private String zoneName;
#OneToOne(cascade = CascadeType.ALL)
private User user;
public Long getZoneId() {
return zoneId;
}
public void setZoneId(Long zoneId) {
this.zoneId = zoneId;
}
public String getZoneName() {
return zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
User.java
package com.example.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
#Entity
public class User {
#Id
#GeneratedValue(strategy=GenerationType.AUTO)
private Long userId;
private String username;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
and my repositories are
EventRepository.java
package com.example.model;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EventRepository extends JpaRepository<Event, Long>, JpaSpecificationExecutor<Event>{
Page<Event> findAllByZoneUser(User user, Pageable pageable);
}
UserRepository.java
package com.example.model;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepository extends JpaRepository<User, Long>{
}
I am calling repository methods directly in my controller like below
UserController.java
package com.example.model;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class UserController {
#Autowired
EventRepository eventRepository;
#Autowired
UserRepository userRepository;
#RequestMapping(value = "/{userId}", method = RequestMethod.GET)
public Map<String, Object> updateUserDO(#PathVariable Long userId) {
Map<String, Object> map = new HashMap<>();
User user = userRepository.findOne(userId);
PageRequest pageRequest = new PageRequest(0, 10, Sort.Direction.ASC, "eventID");
map.put("user", eventRepository.findAllByZoneUser(user, pageRequest));
return map;
}
}