
1
1
.
.
9
9
.
.
2
2
A
A
p
p
p
p
l
l
i
i
c
c
a
a
t
t
i
i
o
o
n
n
-
-
D
D
e
e
s
s
t
t
i
i
n
n
a
a
t
t
i
i
o
o
n
n
This tutorial shows how to create Destination Application which will be used to demonstrate CORS functionality.
Destination Application will run on Port 8085 and it will contain Resource that will be called by Source Application.
Destination Application created in this tutorial will have CORS disabled (since this is default Browser's behavior).
This means that this version of Application will be normal Spring Boot Application without any CORS functionality.
Therefore initially Source Application will not be able to access Resource from Destination Application.
In later tutorials we will show how to enable CORS in this Destination Application in different ways.
Application Schema [Results]
Spring Boot Starters
Enables @Controller, @RequestMapping and Tomcat Server.
Create Project: springboot_cors_destination (add Spring Boot Starters from the table)
Create Package: controllers (inside main package)
– Create Class: MyController.java (inside package controllers)
MyController.java
package com.ivoronline.springboot_cors_source.controllers;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.stereotype.Controller;
@Controller
public class MyController {
@GetMapping("/Hello")
public String hello() {
return "Test";
}
}
http://localhost:8080/Hello