Reputation: 89
I am creating a spring boot application, it' used to filting bad word. Where in any client can submit the request, these request can be GET,POST
But while creating this application, I am getting the following errors:
The structure of my application is:
Model.WordFilter
package com.Website.Step2.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import static javax.persistence.FetchType.LAZY;
import static javax.persistence.GenerationType.IDENTITY;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
public class WordFilter {
@Id
@GeneratedValue(strategy = IDENTITY)
private Long Id;
@NotBlank(message = "Word is required")
private String name;
@ManyToOne(fetch = LAZY)
private User user;
}
WordFilterService
package com.Website.Step2.service;
import com.Website.Step2.dto.WordFilterDto;
import com.Website.Step2.mapper.WordFiterMapper;
import com.Website.Step2.model.WordFilter;
import com.Website.Step2.repository.WordFilterRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import static java.util.stream.Collectors.toList;
@Service
@AllArgsConstructor
public class WordFilterService {
private final WordFilterRepository wordFilterRepository;
private final WordFiterMapper wordFiterMapper;
private final AuthService authService;
public WordFilterDto save(WordFilterDto wordFilterDto) {
WordFilter save = wordFilterRepository.save(wordFiterMapper.mapDtoToWordFilter(wordFilterDto, authService.getCurrentUser()));
wordFilterDto.setId(save.getId());
return wordFilterDto;
}
@Transactional(readOnly = true)
public List<WordFilterDto> getAll() {
return wordFilterRepository.findAll()
.stream()
.map(wordFiterMapper::mapWordFilterToDto)
.collect(toList());
}
}
I know that many questions with the following error, are already been asked, but still I am not able to solve this.
Upvotes: 0
Views: 7519
Reputation: 89
Problem is solved. I just copyed all the WordFilter to another folder and deleted all the WordFilter.And i pasted it again. And it working.
Upvotes: 1