I have a React ui which is supposed to communicate with the backend and fetch data. Backend works well and here is its response to my request: while I receive this error in my React for the same request. The url is the same, the parameters are in place but still there is an error and I am not able
Tag: axios
Issues with CORS preflight Spring/React, reading from authorized/admin endpoint
Im new to both Java (spring) and React and the most issues I seem to get is by the annoying CORS. I did have same CORS issues before and by looking online I found serveral solutions, but mainly the answers were directing to the back-end, that’s where you need to allow certain domains. So I added first @CrossOrigin (I know
Cannot invoke findByEmail because “this.userRepository” is null error
I keep receiving a Cannot invoke “com.***.repositories.UserRepository.findByEmail(String)” because “this.userRepository” is null error everytime I try to process my /register method. I can’t figure out why the code is coming across as null. Controller – Axios call – My UserRepository – Answer Simply add @Autowired to your related fields you want to get Autowired by spring. Change your code from to
react + spring boot upload file and form data
i have a case like in my form (front end), i can fill personal data (name, address, DOB) and then i can attach multiple image. In my spring boot controller : My model wrapper : Front end (React) Code : With above example, i always encounter errors. like : java.io.IOException: Stream closed and zero attachment length / zero attachment size