Home Angular JS and Springboot integration using rest api
Reply: 0

Angular JS and Springboot integration using rest api

user1852 Published in April 24, 2018, 8:23 am

I am trying to connect two different small applications. Client application is in Angular 5 and Server side is in Spring boot. Angular 5 application works fine on localhost:4200/register port and Spring boot (Server Side) works fine on port localhost:8080/api/demo.

For integration I have used added a proxy.conf.json file in Angular Application. I have updated package.json script also. Followed the instruction on the website: http://javasampleapproach.com/java-integration/integrate-angular-4-springboot-web-app-springtoolsuite#5_Import_Angular4_client_project_to_SpringToolSuite.

Both the projects are in same workspace.

Angular project files added for integration---> proxy.conf.json :

    "api": {
        "target": "http://localhost:8080",
        "secure": false
      "name": "my-new-project",
      "version": "0.0.0",
      "license": "MIT",
      "scripts": {
      "ng": "ng",
      "start": "ng serve --proxy-config proxy.conf.json",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e"

SPRINGBOOT ---> Rest API: package com.example.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

public class DemoController {

    //@RequestMapping(method = RequestMethod.GET, value = "/api/demo")
    public String demo() {
        return "Hello Demo Application";


So I want to access url like localhost:4200/api/demo (localhost:4200 is angular and "api/demo" comes from Springboot ) Can someone please guide me here in the right direction. TIA

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305283 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO