├── .gitignore ├── README.adoc ├── backend ├── build.gradle └── src │ └── main │ └── java │ └── angularboot │ ├── AngularBootApplication.java │ ├── controller │ └── ClientRoutesController.java │ └── domain │ ├── Greeting.java │ └── Hero.java ├── build.gradle ├── client ├── .angular-cli.json ├── README.md ├── build.gradle ├── e2e │ ├── app.e2e-spec.ts │ ├── app.po.ts │ └── tsconfig.e2e.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── protractor.conf.js ├── proxy-dev.json ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── dashboard │ │ │ ├── dashboard.component.css │ │ │ ├── dashboard.component.html │ │ │ └── dashboard.component.ts │ │ ├── hero-detail │ │ │ ├── hero-detail.component.css │ │ │ ├── hero-detail.component.html │ │ │ └── hero-detail.component.ts │ │ ├── hero.service.ts │ │ ├── hero.ts │ │ └── heroes │ │ │ ├── heroes.component.css │ │ │ ├── heroes.component.html │ │ │ └── heroes.component.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.css │ ├── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── typings.d.ts ├── tsconfig.json └── tslint.json ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── images ├── intellij_client_configuration.png └── intellij_compound_configuration.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | Java Generated 2 | *.class 3 | *.jar 4 | *.war 5 | *.ear 6 | 7 | 8 | # Gradle 9 | */.gradle/ 10 | .gradle/ 11 | !gradle/wrapper/gradle-wrapper.jar 12 | 13 | 14 | # Compiler 15 | */bin/ 16 | */build/ 17 | */targer/ 18 | */out/ 19 | 20 | 21 | # IntelliJ Generated 22 | .idea/ 23 | *.iws 24 | *.iml 25 | *.ipr 26 | 27 | 28 | # Front End Dependency Generated 29 | client/.sass-cache/ 30 | client/bower_components/ 31 | client/npm-debug.log 32 | client/.tscache/ 33 | client/scss/.tmp/ 34 | client/js/lib/ 35 | client/typings/ 36 | client/coverage/ 37 | */tmp/ 38 | */out-tsc/ 39 | 40 | client/dist/ 41 | client/node/ 42 | client/node/* 43 | */node_modules/ 44 | dist/ 45 | 46 | 47 | # Application 48 | backend/src/main/resources/static -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = Spring 5 + Angular 4 configured and managed by Gradle 2 | Dmitrij Drandarov 3 | :imagesdir: images 4 | :toc: 5 | 6 | == Authors 7 | 8 | * Dmitrij Drandarov | link:https://github.com/dmitrij-drandarov[GitHub] | link:https://www.xing.com/profile/Dmitrij_Drandarov[Xing] 9 | 10 | == Gradle 11 | 12 | - All-In-One 13 | * `gradle bootFullApplication` 14 | - Standalone 15 | * `gradle bootStandaloneClient` 16 | * `gradle bootStandaloneBackend` 17 | 18 | == IntelliJ Run Configuration 19 | 20 | === NPM Run Configuration for Client 21 | image::intellij_client_configuration.png[] 22 | You may then put it in a Compound Build-Configuration: 23 | 24 | === Compound Configuration 25 | image::intellij_compound_configuration.png[] 26 | -------------------------------------------------------------------------------- /backend/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '2.0.0.M4' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | maven { url "https://repo.spring.io/milestone" } 9 | } 10 | 11 | dependencies { 12 | classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion" 13 | } 14 | } 15 | 16 | 17 | 18 | //------------------------------------------------------------------------------------------------------------------------ 19 | // Plugins - Application 20 | //------------------------------------------------------------------------------------------------------------------------ 21 | 22 | apply plugin: 'io.spring.dependency-management' 23 | apply plugin: 'org.springframework.boot' 24 | apply plugin: 'java' 25 | apply plugin: 'war' 26 | 27 | //------------------------------------------------------------------------------------------------------------------------ 28 | // Plugins - Configuration 29 | //------------------------------------------------------------------------------------------------------------------------ 30 | 31 | sourceCompatibility = 1.8 32 | targetCompatibility = 1.8 33 | 34 | war { 35 | baseName = 'spring5_angular4_demo' 36 | version = '1.0' 37 | manifest { 38 | attributes 'Main-Class': 'angularboot.AngularBootApplication' 39 | } 40 | } 41 | 42 | 43 | 44 | //------------------------------------------------------------------------------------------------------------------------ 45 | // Tasks - Standalone backend 46 | //------------------------------------------------------------------------------------------------------------------------ 47 | 48 | task bootStandaloneBackend { 49 | group 'application' 50 | dependsOn bootRun 51 | } 52 | 53 | jar.dependsOn ':client:buildClientToSpring' 54 | war.dependsOn ':client:buildClientToSpring' 55 | 56 | 57 | 58 | //------------------------------------------------------------------------------------------------------------------------ 59 | // Dependencies 60 | //------------------------------------------------------------------------------------------------------------------------ 61 | 62 | dependencies { 63 | compile 'org.springframework.boot:spring-boot-starter-data-neo4j' 64 | compile 'org.springframework.boot:spring-boot-starter-web' 65 | 66 | compileOnly 'org.projectlombok:lombok' 67 | 68 | testCompile 'org.springframework.boot:spring-boot-starter-test' 69 | } -------------------------------------------------------------------------------- /backend/src/main/java/angularboot/AngularBootApplication.java: -------------------------------------------------------------------------------- 1 | package angularboot; 2 | 3 | import angularboot.domain.Greeting; 4 | import angularboot.domain.Hero; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.util.Arrays; 11 | import java.util.List; 12 | import java.util.Random; 13 | import java.util.UUID; 14 | import java.util.stream.Collectors; 15 | 16 | @RestController 17 | @RequestMapping("api") 18 | @SpringBootApplication 19 | public class AngularBootApplication { 20 | 21 | private static final List HEROES; 22 | 23 | static { 24 | Random r = new Random(); 25 | 26 | final String[] NAMES = { 27 | "Mr. Nice", 28 | "Narco", 29 | "Bombasto", 30 | "Celeritas", 31 | "Magneta", 32 | "RubberMan", 33 | "Dynama", 34 | "Dr IQ", 35 | "Magma", 36 | "Tornado"}; 37 | 38 | HEROES = Arrays.stream(NAMES) 39 | .map(name -> new Hero(r.ints(0,20).findFirst().orElse(0), name)) 40 | .collect(Collectors.toList()); 41 | } 42 | 43 | public static void main(String[] args) { 44 | SpringApplication.run(AngularBootApplication.class, args); 45 | } 46 | 47 | @RequestMapping("/resource") 48 | public Greeting home() { 49 | Greeting greeting = new Greeting(); 50 | greeting.setId(UUID.randomUUID().toString()); 51 | greeting.setContent("Hello World"); 52 | return greeting; 53 | } 54 | 55 | @RequestMapping("/heroes") 56 | public List getHeroes() { 57 | return HEROES; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /backend/src/main/java/angularboot/controller/ClientRoutesController.java: -------------------------------------------------------------------------------- 1 | package angularboot.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | @Controller 7 | public class ClientRoutesController { 8 | 9 | @RequestMapping({ 10 | "/dashboard", 11 | "/heroes", 12 | "/detail/*" 13 | }) 14 | public String forwardToClientApp(){ 15 | return "forward:/index.html"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /backend/src/main/java/angularboot/domain/Greeting.java: -------------------------------------------------------------------------------- 1 | package angularboot.domain; 2 | 3 | public class Greeting { 4 | String id; 5 | String content; 6 | 7 | public String getId() { 8 | return id; 9 | } 10 | 11 | public void setId(String id) { 12 | this.id = id; 13 | } 14 | 15 | public String getContent() { 16 | return content; 17 | } 18 | 19 | public void setContent(String content) { 20 | this.content = content; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /backend/src/main/java/angularboot/domain/Hero.java: -------------------------------------------------------------------------------- 1 | package angularboot.domain; 2 | 3 | public class Hero { 4 | int id; 5 | String name; 6 | 7 | public Hero(int id, String name) { 8 | this.id = id; 9 | this.name = name; 10 | } 11 | 12 | public int getId() { 13 | return id; 14 | } 15 | 16 | public void setId(int id) { 17 | this.id = id; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | group = 'com.dmitrij-drandarov' 2 | version = '0.0.1-SNAPSHOT' 3 | 4 | 5 | 6 | allprojects { 7 | repositories { 8 | mavenCentral() 9 | maven { url "https://repo.spring.io/snapshot" } 10 | maven { url "https://repo.spring.io/milestone" } 11 | } 12 | } 13 | 14 | 15 | 16 | //------------------------------------------------------------------------------------------------------------------------ 17 | // Tasks - Application 18 | //------------------------------------------------------------------------------------------------------------------------ 19 | 20 | task bootFullApplication(type: GradleBuild) { 21 | group 'application' 22 | setTasks([':client:npmUpdate', ':client:clean', ':client:buildClientToSpring', ':backend:bootRun']) 23 | } 24 | 25 | //------------------------------------------------------------------------------------------------------------------------ 26 | // Tasks - Init project 27 | //------------------------------------------------------------------------------------------------------------------------ 28 | 29 | task wrapper(type: Wrapper) { 30 | group 'init' 31 | gradleVersion '4.2' 32 | distributionType Wrapper.DistributionType.ALL 33 | } -------------------------------------------------------------------------------- /client/.angular-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "project": { 4 | "name": "client" 5 | }, 6 | "apps": [ 7 | { 8 | "root": "src", 9 | "outDir": "dist", 10 | "assets": [ 11 | "assets", 12 | "favicon.ico" 13 | ], 14 | "index": "index.html", 15 | "main": "main.ts", 16 | "polyfills": "polyfills.ts", 17 | "test": "test.ts", 18 | "tsconfig": "tsconfig.app.json", 19 | "testTsconfig": "tsconfig.spec.json", 20 | "prefix": "app", 21 | "styles": [ 22 | "styles.css" 23 | ], 24 | "scripts": [], 25 | "environmentSource": "environments/environment.ts", 26 | "environments": { 27 | "dev": "environments/environment.ts", 28 | "prod": "environments/environment.prod.ts" 29 | } 30 | } 31 | ], 32 | "e2e": { 33 | "protractor": { 34 | "config": "./protractor.conf.js" 35 | } 36 | }, 37 | "lint": [ 38 | { 39 | "project": "src/tsconfig.app.json", 40 | "exclude": "**/node_modules/**" 41 | }, 42 | { 43 | "project": "src/tsconfig.spec.json", 44 | "exclude": "**/node_modules/**" 45 | }, 46 | { 47 | "project": "e2e/tsconfig.e2e.json", 48 | "exclude": "**/node_modules/**" 49 | } 50 | ], 51 | "test": { 52 | "karma": { 53 | "config": "./karma.conf.js" 54 | } 55 | }, 56 | "defaults": { 57 | "styleExt": "css", 58 | "component": {} 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | # Client 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.4.2. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | Before running the tests make sure you are serving the app via `ng serve`. 25 | 26 | ## Further help 27 | 28 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 29 | -------------------------------------------------------------------------------- /client/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | gradleNodeVersion = '1.2.0' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | maven { url "https://plugins.gradle.org/m2/" } 9 | } 10 | 11 | dependencies { 12 | classpath "com.moowork.gradle:gradle-node-plugin:$gradleNodeVersion" 13 | } 14 | } 15 | 16 | 17 | 18 | //------------------------------------------------------------------------------------------------------------------------ 19 | // Plugins - Application 20 | //------------------------------------------------------------------------------------------------------------------------ 21 | 22 | apply plugin: 'com.moowork.node' 23 | 24 | //------------------------------------------------------------------------------------------------------------------------ 25 | // Plugin configuration 26 | //------------------------------------------------------------------------------------------------------------------------ 27 | 28 | node { 29 | version = '8.5.0' 30 | npmVersion = '5.4.2' 31 | download = true 32 | workDir = file("${rootDir}/client/node") 33 | nodeModulesDir = file("${rootDir}/client") 34 | } 35 | 36 | 37 | 38 | //------------------------------------------------------------------------------------------------------------------------ 39 | // Tasks - NPM 40 | //------------------------------------------------------------------------------------------------------------------------ 41 | 42 | task clean(type: Delete) { 43 | group 'build client' 44 | delete "${rootDir}/client/dist", "${rootDir}/backend/src/main/resources/static" 45 | } 46 | 47 | task cleanNpm(type: Delete) { 48 | group 'build client' 49 | dependsOn 'clean' 50 | delete "${rootDir}/client/node", "${rootDir}/client/node_modules" 51 | } 52 | 53 | task npmUpdate { 54 | group 'build client' 55 | dependsOn 'npm_update' 56 | } 57 | 58 | //------------------------------------------------------------------------------------------------------------------------ 59 | // Tasks - Standalone client 60 | //------------------------------------------------------------------------------------------------------------------------ 61 | 62 | task buildStandaloneClient(type: NpmTask, dependsOn: npmInstall) { 63 | group 'build client' 64 | description = 'Compile client side folder for development' 65 | args = ['run', 'buildStandalone'] 66 | } 67 | 68 | task serveStandaloneClientWatch(type: NpmTask, dependsOn: npmInstall) { 69 | group 'build client' 70 | description = "Builds, serves and watches the client side assets for rebuilding" 71 | args = ['run', 'serveStandaloneWatch'] 72 | } 73 | 74 | task serveStandaloneClient(type: NpmTask, dependsOn: npmInstall) { 75 | group 'build client' 76 | description = "Compile client side folder for production" 77 | args = ['start'] 78 | } 79 | 80 | task bootStandaloneClient(type: GradleBuild) { 81 | group 'application' 82 | setTasks(['clean', 'buildStandaloneClient', 'serveStandaloneClient']) 83 | // finalizedBy 'npm_shutdown' 84 | } 85 | 86 | task bootStandaloneClientWatch(type: GradleBuild) { 87 | group 'application' 88 | setTasks(['clean', 'serveStandaloneClientWatch']) 89 | // finalizedBy 'npm_shutdown' 90 | } 91 | 92 | //------------------------------------------------------------------------------------------------------------------------ 93 | // Tasks - Integrated client 94 | //------------------------------------------------------------------------------------------------------------------------ 95 | 96 | task buildClientToSpring(type: NpmTask, dependsOn: npmInstall) { 97 | group 'build client' 98 | description = 'Compile client side folder for development' 99 | args = ['run', 'buildToSpring'] 100 | } 101 | -------------------------------------------------------------------------------- /client/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('client App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /client/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /client/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /client/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular/cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular/cli/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | angularCli: { 23 | environment: 'dev' 24 | }, 25 | reporters: ['progress', 'kjhtml'], 26 | port: 9876, 27 | colors: true, 28 | logLevel: config.LOG_INFO, 29 | autoWatch: true, 30 | browsers: ['Chrome'], 31 | singleRun: false 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "ng", 7 | "start": "ng serve --proxy-config proxy-dev.json", 8 | "buildProd": "ng build --prod", 9 | "buildStandalone": "ng build", 10 | "serveStandaloneWatch": "ng serve --proxy-config proxy-dev.json --watch=true", 11 | "buildToSpring": "ng build --prod --op=../backend/src/main/resources/static", 12 | "test": "ng test", 13 | "lint": "ng lint", 14 | "e2e": "ng e2e" 15 | }, 16 | "private": true, 17 | "dependencies": { 18 | "@angular/animations": "^4.4.7", 19 | "@angular/common": "^4.4.7", 20 | "@angular/compiler": "^4.4.7", 21 | "@angular/core": "^4.4.7", 22 | "@angular/forms": "^4.4.7", 23 | "@angular/http": "^4.4.7", 24 | "@angular/platform-browser": "^4.4.7", 25 | "@angular/platform-browser-dynamic": "^4.4.7", 26 | "@angular/router": "^4.4.7", 27 | "core-js": "^2.5.7", 28 | "rxjs": "^5.5.12", 29 | "zone.js": "^0.8.26" 30 | }, 31 | "devDependencies": { 32 | "@angular/cli": "1.4.2", 33 | "@angular/compiler-cli": "^4.2.4", 34 | "@angular/language-service": "^4.2.4", 35 | "@types/jasmine": "~2.5.53", 36 | "@types/jasminewd2": "~2.0.2", 37 | "@types/node": "~6.0.60", 38 | "codelyzer": "~3.1.1", 39 | "jasmine-core": "~2.6.2", 40 | "jasmine-spec-reporter": "~4.1.0", 41 | "karma": "~1.7.0", 42 | "karma-chrome-launcher": "~2.1.1", 43 | "karma-cli": "~1.0.1", 44 | "karma-coverage-istanbul-reporter": "^1.2.1", 45 | "karma-jasmine": "~1.1.0", 46 | "karma-jasmine-html-reporter": "^0.2.2", 47 | "protractor": "~5.1.2", 48 | "ts-node": "~3.2.0", 49 | "tslint": "~5.3.2", 50 | "typescript": "~2.3.3" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /client/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /client/proxy-dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "/api/*": { 3 | "target": "http://localhost:8080", 4 | "secure": false 5 | } 6 | } -------------------------------------------------------------------------------- /client/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | import { DashboardComponent } from './dashboard/dashboard.component'; 5 | import { HeroesComponent } from './heroes/heroes.component'; 6 | import { HeroDetailComponent } from './hero-detail/hero-detail.component'; 7 | 8 | const routes: Routes = [ 9 | { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, 10 | { path: 'dashboard', component: DashboardComponent }, 11 | { path: 'detail/:id', component: HeroDetailComponent }, 12 | { path: 'heroes', component: HeroesComponent } 13 | ]; 14 | 15 | @NgModule({ 16 | imports: [ RouterModule.forRoot(routes) ], 17 | exports: [ RouterModule ] 18 | }) 19 | export class AppRoutingModule {} 20 | -------------------------------------------------------------------------------- /client/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | font-size: 1.2em; 3 | color: #999; 4 | margin-bottom: 0; 5 | } 6 | h2 { 7 | font-size: 2em; 8 | margin-top: 0; 9 | padding-top: 0; 10 | } 11 | nav a { 12 | padding: 5px 10px; 13 | text-decoration: none; 14 | margin-top: 10px; 15 | display: inline-block; 16 | background-color: #eee; 17 | border-radius: 4px; 18 | } 19 | nav a:visited, a:link { 20 | color: #607D8B; 21 | } 22 | nav a:hover { 23 | color: #039be5; 24 | background-color: #CFD8DC; 25 | } 26 | nav a.active { 27 | color: #039be5; 28 | } -------------------------------------------------------------------------------- /client/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |

{{title}}

2 | 6 | -------------------------------------------------------------------------------- /client/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'Tour of Heroes'; 10 | } 11 | -------------------------------------------------------------------------------- /client/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { HttpModule } from '@angular/http'; 5 | 6 | import { AppComponent } from './app.component'; 7 | import { DashboardComponent } from './dashboard/dashboard.component'; 8 | import { HeroDetailComponent } from './hero-detail/hero-detail.component'; 9 | import { HeroesComponent } from './heroes/heroes.component'; 10 | import { HeroService } from './hero.service'; 11 | 12 | import { AppRoutingModule } from './app-routing.module'; 13 | 14 | @NgModule({ 15 | imports: [ 16 | BrowserModule, 17 | FormsModule, 18 | AppRoutingModule, 19 | HttpModule 20 | ], 21 | declarations: [ 22 | AppComponent, 23 | DashboardComponent, 24 | HeroDetailComponent, 25 | HeroesComponent 26 | ], 27 | providers: [ HeroService ], 28 | bootstrap: [ AppComponent ] 29 | }) 30 | export class AppModule { } 31 | -------------------------------------------------------------------------------- /client/src/app/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | [class*='col-'] { 2 | float: left; 3 | padding-right: 20px; 4 | padding-bottom: 20px; 5 | } 6 | [class*='col-']:last-of-type { 7 | padding-right: 0; 8 | } 9 | a { 10 | text-decoration: none; 11 | } 12 | *, *:after, *:before { 13 | -webkit-box-sizing: border-box; 14 | -moz-box-sizing: border-box; 15 | box-sizing: border-box; 16 | } 17 | h3 { 18 | text-align: center; margin-bottom: 0; 19 | } 20 | h4 { 21 | position: relative; 22 | } 23 | .grid { 24 | margin: 0; 25 | } 26 | .col-1-4 { 27 | width: 25%; 28 | } 29 | .module { 30 | padding: 20px; 31 | text-align: center; 32 | color: #eee; 33 | max-height: 120px; 34 | min-width: 120px; 35 | background-color: #607D8B; 36 | border-radius: 2px; 37 | } 38 | .module:hover { 39 | background-color: #EEE; 40 | cursor: pointer; 41 | color: #607d8b; 42 | } 43 | .grid-pad { 44 | padding: 10px 0; 45 | } 46 | .grid-pad > [class*='col-']:last-of-type { 47 | padding-right: 20px; 48 | } 49 | @media (max-width: 600px) { 50 | .module { 51 | font-size: 10px; 52 | max-height: 75px; } 53 | } 54 | @media (max-width: 1024px) { 55 | .grid { 56 | margin: 0; 57 | } 58 | .module { 59 | min-width: 60px; 60 | } 61 | } -------------------------------------------------------------------------------- /client/src/app/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |

Top Heroes

2 | 9 | -------------------------------------------------------------------------------- /client/src/app/dashboard/dashboard.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Hero } from '../hero'; 4 | import { HeroService } from '../hero.service'; 5 | 6 | @Component({ 7 | selector: 'app-my-dashboard', 8 | templateUrl: './dashboard.component.html', 9 | styleUrls: [ './dashboard.component.css' ], 10 | providers: [HeroService] 11 | }) 12 | 13 | export class DashboardComponent implements OnInit { 14 | heroes: Hero[] = []; 15 | constructor(private heroService: HeroService) { } 16 | ngOnInit(): void { 17 | this.heroService.getHeroes() 18 | .then(heroes => this.heroes = heroes.slice(1, 5)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /client/src/app/hero-detail/hero-detail.component.css: -------------------------------------------------------------------------------- 1 | label { 2 | display: inline-block; 3 | width: 3em; 4 | margin: .5em 0; 5 | color: #607D8B; 6 | font-weight: bold; 7 | } 8 | input { 9 | height: 2em; 10 | font-size: 1em; 11 | padding-left: .4em; 12 | } 13 | button { 14 | margin-top: 20px; 15 | font-family: Arial; 16 | background-color: #eee; 17 | border: none; 18 | padding: 5px 10px; 19 | border-radius: 4px; 20 | cursor: pointer; cursor: hand; 21 | } 22 | button:hover { 23 | background-color: #cfd8dc; 24 | } 25 | button:disabled { 26 | background-color: #eee; 27 | color: #ccc; 28 | cursor: auto; 29 | } -------------------------------------------------------------------------------- /client/src/app/hero-detail/hero-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |

{{hero.name}} details!

3 |
4 | {{hero.id}}
5 |
6 | 7 | 8 |
9 | 10 |
-------------------------------------------------------------------------------- /client/src/app/hero-detail/hero-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, ParamMap } from '@angular/router'; 3 | import { Location } from '@angular/common'; 4 | 5 | import { HeroService } from '../hero.service'; 6 | import { Hero } from '../hero'; 7 | import 'rxjs/add/operator/switchMap'; 8 | 9 | @Component({ 10 | selector: 'app-hero-detail', 11 | templateUrl: './hero-detail.component.html', 12 | styleUrls: ['./hero-detail.component.css'], 13 | }) 14 | export class HeroDetailComponent implements OnInit { 15 | constructor( 16 | private heroService: HeroService, 17 | private route: ActivatedRoute, 18 | private location: Location 19 | ) {} 20 | @Input() hero: Hero; 21 | ngOnInit(): void { 22 | this.route.paramMap 23 | .switchMap((params: ParamMap) => this.heroService.getHero(+params.get('id'))) 24 | .subscribe(hero => this.hero = hero); 25 | } 26 | goBack(): void { 27 | this.location.back(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/src/app/hero.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Headers, Http } from '@angular/http'; 3 | 4 | import 'rxjs/add/operator/toPromise'; 5 | 6 | import { Hero } from './hero'; 7 | 8 | @Injectable() 9 | export class HeroService { 10 | private greetingUrl = 'api/heroes'; 11 | 12 | constructor(private http: Http) { } 13 | 14 | getHeroes(): Promise { 15 | return this.http.get(this.greetingUrl).toPromise() 16 | .then(response => response.json() as Hero[]).catch(this.handleError); 17 | } 18 | 19 | getHero(id: number): Promise { 20 | return this.getHeroes() 21 | .then(heroes => heroes.find(hero => hero.id === id)); 22 | } 23 | 24 | private handleError(error: any): Promise { 25 | console.error('An error occurred', error); 26 | return Promise.reject(error.message || error); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /client/src/app/hero.ts: -------------------------------------------------------------------------------- 1 | export class Hero { 2 | id: number; 3 | name: string; 4 | } 5 | -------------------------------------------------------------------------------- /client/src/app/heroes/heroes.component.css: -------------------------------------------------------------------------------- 1 | .selected { 2 | background-color: #CFD8DC !important; 3 | color: white; 4 | } 5 | .heroes { 6 | margin: 0 0 2em 0; 7 | list-style-type: none; 8 | padding: 0; 9 | width: 15em; 10 | } 11 | .heroes li { 12 | cursor: pointer; 13 | position: relative; 14 | left: 0; 15 | background-color: #EEE; 16 | margin: .5em; 17 | padding: .3em 0; 18 | height: 1.6em; 19 | border-radius: 4px; 20 | } 21 | .heroes li:hover { 22 | color: #607D8B; 23 | background-color: #DDD; 24 | left: .1em; 25 | } 26 | .heroes li.selected:hover { 27 | background-color: #BBD8DC !important; 28 | color: white; 29 | } 30 | .heroes .text { 31 | position: relative; 32 | top: -3px; 33 | } 34 | .heroes .badge { 35 | display: inline-block; 36 | font-size: small; 37 | color: white; 38 | padding: 0.8em 0.7em 0 0.7em; 39 | background-color: #607D8B; 40 | line-height: 1em; 41 | position: relative; 42 | left: -1px; 43 | top: -4px; 44 | height: 1.8em; 45 | margin-right: .8em; 46 | border-radius: 4px 0 0 4px; 47 | } 48 | button { 49 | font-family: Arial; 50 | background-color: #eee; 51 | border: none; 52 | padding: 5px 10px; 53 | border-radius: 4px; 54 | cursor: pointer; 55 | cursor: hand; 56 | } 57 | button:hover { 58 | background-color: #cfd8dc; 59 | } -------------------------------------------------------------------------------- /client/src/app/heroes/heroes.component.html: -------------------------------------------------------------------------------- 1 |

My Heroes

2 |
    3 |
  • 6 | {{hero.id}} {{hero.name}} 7 |
  • 8 |
9 |
10 |

11 | {{selectedHero.name | uppercase}} is my hero 12 |

13 | 14 |
15 | -------------------------------------------------------------------------------- /client/src/app/heroes/heroes.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { Hero } from '../hero'; 4 | import { HeroService } from '../hero.service'; 5 | 6 | @Component({ 7 | selector: 'app-my-heroes', 8 | templateUrl: './heroes.component.html', 9 | styleUrls: [ './heroes.component.css' ], 10 | providers: [HeroService] 11 | }) 12 | export class HeroesComponent implements OnInit { 13 | heroes: Hero[]; 14 | selectedHero: Hero; 15 | constructor( 16 | private router: Router, 17 | private heroService: HeroService) { } 18 | getHeroes(): void { 19 | this.heroService.getHeroes().then(heroes => this.heroes = heroes); 20 | } 21 | ngOnInit(): void { 22 | this.getHeroes(); 23 | } 24 | onSelect(hero: Hero): void { 25 | this.selectedHero = hero; 26 | } 27 | gotoDetail(): void { 28 | this.router.navigate(['/detail', this.selectedHero.id]); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drandarov-io/Spring-5-Angular-4-Gradle-Example/1ab121a4d85d2db8e762541819029fd9289ac4e3/client/src/assets/.gitkeep -------------------------------------------------------------------------------- /client/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /client/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /client/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drandarov-io/Spring-5-Angular-4-Gradle-Example/1ab121a4d85d2db8e762541819029fd9289ac4e3/client/src/favicon.ico -------------------------------------------------------------------------------- /client/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Client 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /client/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /client/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** Evergreen browsers require these. **/ 41 | import 'core-js/es6/reflect'; 42 | import 'core-js/es7/reflect'; 43 | 44 | 45 | /** 46 | * Required to support Web Animations `@angular/animation`. 47 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 48 | **/ 49 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 50 | 51 | 52 | 53 | /*************************************************************************************************** 54 | * Zone JS is required by Angular itself. 55 | */ 56 | import 'zone.js/dist/zone'; // Included with Angular CLI. 57 | 58 | 59 | 60 | /*************************************************************************************************** 61 | * APPLICATION IMPORTS 62 | */ 63 | 64 | /** 65 | * Date, currency, decimal and percent pipes. 66 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 67 | */ 68 | // import 'intl'; // Run `npm install --save intl`. 69 | /** 70 | * Need to import at least one locale-data with intl. 71 | */ 72 | // import 'intl/locale-data/jsonp/en'; 73 | -------------------------------------------------------------------------------- /client/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | /* Master Styles */ 3 | h1 { 4 | color: #369; 5 | font-family: Arial, Helvetica, sans-serif; 6 | font-size: 250%; 7 | } 8 | h2, h3 { 9 | color: #444; 10 | font-family: Arial, Helvetica, sans-serif; 11 | font-weight: lighter; 12 | } 13 | body { 14 | margin: 2em; 15 | } 16 | body, input[text], button { 17 | color: #888; 18 | font-family: Cambria, Georgia; 19 | } 20 | /* everywhere else */ 21 | * { 22 | font-family: Arial, Helvetica, sans-serif; 23 | } 24 | -------------------------------------------------------------------------------- /client/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /client/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /client/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /client/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /client/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "eofline": true, 15 | "forin": true, 16 | "import-blacklist": [ 17 | true, 18 | "rxjs" 19 | ], 20 | "import-spacing": true, 21 | "indent": [ 22 | true, 23 | "spaces" 24 | ], 25 | "interface-over-type-literal": true, 26 | "label-position": true, 27 | "max-line-length": [ 28 | true, 29 | 140 30 | ], 31 | "member-access": false, 32 | "member-ordering": [ 33 | true, 34 | { 35 | "order": [ 36 | "static-field", 37 | "instance-field", 38 | "static-method", 39 | "instance-method" 40 | ] 41 | } 42 | ], 43 | "no-arg": true, 44 | "no-bitwise": true, 45 | "no-console": [ 46 | true, 47 | "debug", 48 | "info", 49 | "time", 50 | "timeEnd", 51 | "trace" 52 | ], 53 | "no-construct": true, 54 | "no-debugger": true, 55 | "no-duplicate-super": true, 56 | "no-empty": false, 57 | "no-empty-interface": true, 58 | "no-eval": true, 59 | "no-inferrable-types": [ 60 | true, 61 | "ignore-params" 62 | ], 63 | "no-misused-new": true, 64 | "no-non-null-assertion": true, 65 | "no-shadowed-variable": true, 66 | "no-string-literal": false, 67 | "no-string-throw": true, 68 | "no-switch-case-fall-through": true, 69 | "no-trailing-whitespace": true, 70 | "no-unnecessary-initializer": true, 71 | "no-unused-expression": true, 72 | "no-use-before-declare": true, 73 | "no-var-keyword": true, 74 | "object-literal-sort-keys": false, 75 | "one-line": [ 76 | true, 77 | "check-open-brace", 78 | "check-catch", 79 | "check-else", 80 | "check-whitespace" 81 | ], 82 | "prefer-const": true, 83 | "quotemark": [ 84 | true, 85 | "single" 86 | ], 87 | "radix": true, 88 | "semicolon": [ 89 | true, 90 | "always" 91 | ], 92 | "triple-equals": [ 93 | true, 94 | "allow-null-check" 95 | ], 96 | "typedef-whitespace": [ 97 | true, 98 | { 99 | "call-signature": "nospace", 100 | "index-signature": "nospace", 101 | "parameter": "nospace", 102 | "property-declaration": "nospace", 103 | "variable-declaration": "nospace" 104 | } 105 | ], 106 | "typeof-compare": true, 107 | "unified-signatures": true, 108 | "variable-name": false, 109 | "whitespace": [ 110 | true, 111 | "check-branch", 112 | "check-decl", 113 | "check-operator", 114 | "check-separator", 115 | "check-type" 116 | ], 117 | "directive-selector": [ 118 | true, 119 | "attribute", 120 | "app", 121 | "camelCase" 122 | ], 123 | "component-selector": [ 124 | true, 125 | "element", 126 | "app", 127 | "kebab-case" 128 | ], 129 | "use-input-property-decorator": true, 130 | "use-output-property-decorator": true, 131 | "use-host-property-decorator": true, 132 | "no-input-rename": true, 133 | "no-output-rename": true, 134 | "use-life-cycle-interface": true, 135 | "use-pipe-transform-interface": true, 136 | "component-class-suffix": true, 137 | "directive-class-suffix": true, 138 | "no-access-missing-member": true, 139 | "templates-use-public": true, 140 | "invoke-injectable": true 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=false -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drandarov-io/Spring-5-Angular-4-Gradle-Example/1ab121a4d85d2db8e762541819029fd9289ac4e3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-all.zip 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /images/intellij_client_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drandarov-io/Spring-5-Angular-4-Gradle-Example/1ab121a4d85d2db8e762541819029fd9289ac4e3/images/intellij_client_configuration.png -------------------------------------------------------------------------------- /images/intellij_compound_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drandarov-io/Spring-5-Angular-4-Gradle-Example/1ab121a4d85d2db8e762541819029fd9289ac4e3/images/intellij_compound_configuration.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'spring_5_angular_4_example' 2 | 3 | include 'client', 4 | 'backend' --------------------------------------------------------------------------------