How to get json response only with an id of the related entity


Fetching entities with complex relationships can consume a lot of resources during calls to your API. To minimize the size of the requested json string, you can use the LAZY fetch type. This will result in accessing only the serialized object and its properties – without considering its relations. But often you need to obtain the identifiers of the associated objects as well. Check out how to fetch an entity with an id of a related object while preserving proper serialization and deserialization.

Test parent and child components when passing data with input binding

Angular supports the decomposition of components by allowing you to include one into another. To test a component that contains other elements you have to declare them in the test configuration. Don’t forget about any @Input property of an aggregated component or running the test suite will result with the following error: Template parse errors: Can’t bind to property since it isn’t a known property of component

Fix CORS issues between Spring Boot and Angular on localhost


An Angular app is served by a different host than a Spring Boot API, so reaching for data via REST API will result in the following error: “Failed to load http://localhost:8080/api: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:4200’ is therefore not allowed access.” Read this post to learn how to configure Cross-origin resource sharing (CORS) to enable the cross-domain communication on a development environment.