cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting CORS Error while fetching Spring boot API in UI5 Application through ajax call.

madhav15
Participant
862

Greetings to all, I am developing a UI5 application using Spring boot application as backend and connected to SAP HANA cloud Database. I am getting CORS Error: No "Access-Control-Allow-Origin" header present on request resource, and in network tab with 200 status code.

My backend application setup- I created Spring Starter Project version 2.5.5 using JavaSE 1.8 . Created a REST API in Spring boot application controller which I am using in ajax call.

For connecting Spring boot app to HANA cloud database I provided credential in application properties and added the ngdbc dependency in pom.xml, after I deployed the application in Cloud Foundry environment using following manifest.yml. Rest API after Cloud Foundry Deployment working properly fine.

My UI5 Application setup: In UI5 application I fetch Rest API using ajax call.

I google the error and I applied some changes in backend API like using @CrossOrigin in API level and controller level both and also tried at ajax level in UI5 Application can be seen in above code in commented part.

And also tried to enable CORS using globally, declare in Bean Class like using allowedOrigins(), allowedHeaders(), addMapping("/**"), exposedHeaders() etc methods but nothing works.

Please guide me for this and also suggest that how can I use/consume REST API in SAP BTP.

Thanks

Accepted Solutions (0)

Answers (0)