Angular 2 与 Spring Boot 集成为单战 [英] Angular 2 integrate with spring boot as single war

查看:20
本文介绍了Angular 2 与 Spring Boot 集成为单战的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中使用独立的 angular js2.在将 angular js2 构建集成到 Spring Boot Web 应用程序文件以部署为单个战争之后.然后得到这样的错误

In my application working with angular js2 standalone. After integrating angular js2 build to spring boot web app files for deploy as single war. then getting error like this

我尝试了两个 senarioes1)添加 npm intall 和 npm run build add 作为 maven 执行目标.2)Angularjs 使用命令手动构建,这些命令将复制到 Web 应用程序目录,然后构建战争.这些战争将初始化我的本地主机然后得到这些 js 丢失的问题.我是 angular2 的新手我的工作环境节点:v8.1.2npm -: v5.0.3角度:1.2

I tried two senarioes 1) add npm intall and npm run build add as maven exucution goals. 2)Angularjs build manually by using commands that build out out copy to web app directry then build war. These war put inito my local host then get these js missing problem. I'm new in angular2 My working environment Node : v8.1.2 npm -: v5.0.3 anular: 1.2

 "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.0",
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/router": "^3.4.0",
    "angular2-cookie": "^1.2.6",
    "animate.css": "^3.5.2",
    "arrive": "^2.3.1",
    "bootstrap": "^3.3.5",
    "bootstrap-notify": "^3.1.3",
    "bootstrap-select": "^1.12.2",
    "bootstrap-tagsinput": "^0.7.1",
    "chartist": "^0.9.4",
    "chartist-plugin-zoom": "^0.4.0",
    "chartjs-plugin-zoom": "^0.5.0",
    "core-js": "^2.4.1",
    "datatables": "1.10.12",
    "datatables.net-bs": "1.10.12",
    "datatables.net-responsive": "^2.1.1",
    "domready": "^1.0.8",
    "eonasdan-bootstrap-datetimepicker": "4.17.47",
    "fullcalendar": "^3.4.0",
    "googleapis": "^19.0.0",
    "jasny-bootstrap": "^3.1.3",
    "jquery": "^1.12.4",
    "lodash": "^4.17.4",
    "ng2-cookies": "^1.0.12",
    "ng2-datepicker": "^1.8.3",
    "ng2-daterangepicker": "^2.0.7",
    "nouislider": "^9.2.0",
    "pretty-error": "^2.1.1",
    "rxjs": "^5.1.0",
    "twitter-bootstrap-wizard": "^1.2.0",
    "validate": "^3.0.1",
    "web-animations-js": "^2.2.2",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "1.1.3",
    "@angular/compiler-cli": "^2.4.0",
    "@types/bootstrap": "^3.3.32",
    "@types/chartist": "^0.9.34",
    "@types/jasmine": "2.5.38",
    "@types/jquery": "^1.10.33",
    "@types/node": "^6.0.73",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.0.0",
    "webpack": "^3.0.0"
  },
  "description": "This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0-rc.2.",
  "bugs": {
    "url": "https://github.com/creativetimofficial/material-dashboard-pro-angular/issues"
  },
  "homepage": "https://github.com/creativetimofficial/material-dashboard-pro-angular#readme",
  "main": "karma.conf.js",
  "keywords": [],
  "author": ""
}

推荐答案

确保 angular 构建成功,目标与您希望嵌入的应用程序相同.假设您的 Spring Boot 应用程序将在

Make sure the angular build successfully with same target which application you wish to embed. Suppose your spring boot application will be running in

本地主机:8080

角度目标应该相同.否则,与 Spring 集成时会失败.

the angular target should be same. Other wise it will be fail when you integrate with Spring.

这篇关于Angular 2 与 Spring Boot 集成为单战的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆