Решением, которое помогло, было разместить аннотацию CORS на моем контроллере rest в Java, так что, вероятно, здесь может помочь только код на стороне сервера.

ользую следующий код для отправки запроса

import { Http, Headers, Response } from '@angular/http';

@Injectable()
export class AuthenticationService {
    private _options = new Headers({'Content-Type': 'application/json'});
    
    constructor(private http: Http) { }

    login(username: string, password: string) {
           return this.http.post('http://localhost:56451/map',
              { "username": username, "password": password },
              this._options);
    }
}

Однако я получаю следующую ошибку в VScode

Argument of type '{ headers: HttpHeaders; }' is not assignable to parameter of type 'RequestOptionsArgs'. Types 
 of property 'headers' are incompatible. Type 'HttpHeaders' is not assignable to type 'Headers'. Property 'forEach' 
 is missing in type 'HttpHeaders'.

Пожалуйста, помогите уточнить связанные понятия

Ответы на вопрос(2)

Ваш ответ на вопрос