employeeList = employeeServiceProxy.getAllEmployees();
+ assertEquals(employeeList.size(), employeeCount);
+ }
+
+ @Test
+ public void givenEmployees_whenGetAvailableEmployee_thenCorrectEmployeeReturned() throws EmployeeNotFound {
+ Employee employee = employeeServiceProxy.getEmployee(2);
+ assertEquals(employee.getFirstName(), "Jack");
+ }
+
+ @Test(expected = EmployeeNotFound.class)
+ public void givenEmployees_whenGetNonAvailableEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
+ employeeServiceProxy.getEmployee(20);
+ }
+
+ @Test
+ public void givenEmployees_whenAddNewEmployee_thenEmployeeCountIncreased() throws EmployeeAlreadyExists {
+ int employeeCount = employeeServiceProxy.countEmployees();
+ employeeServiceProxy.addEmployee(4, "Anna");
+ assertEquals(employeeServiceProxy.countEmployees(), employeeCount + 1);
+ }
+
+ @Test(expected = EmployeeAlreadyExists.class)
+ public void givenEmployees_whenAddAlreadyExistingEmployee_thenEmployeeAlreadyExistsException() throws EmployeeAlreadyExists {
+ employeeServiceProxy.addEmployee(1, "Anna");
+ }
+
+ @Test
+ public void givenEmployees_whenUpdateExistingEmployee_thenUpdatedEmployeeReturned() throws EmployeeNotFound {
+ Employee updated = employeeServiceProxy.updateEmployee(1, "Joan");
+ assertEquals(updated.getFirstName(), "Joan");
+ }
+
+ @Test(expected = EmployeeNotFound.class)
+ public void givenEmployees_whenUpdateNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
+ employeeServiceProxy.updateEmployee(20, "Joan");
+ }
+
+ @Test
+ public void givenEmployees_whenDeleteExistingEmployee_thenSuccessReturned() throws EmployeeNotFound {
+ boolean deleteEmployee = employeeServiceProxy.deleteEmployee(3);
+ assertEquals(deleteEmployee, true);
+ }
+
+ @Test(expected = EmployeeNotFound.class)
+ public void givenEmployee_whenDeleteNonExistingEmployee_thenEmployeeNotFoundException() throws EmployeeNotFound {
+ employeeServiceProxy.deleteEmployee(20);
+ }
+
+}
diff --git a/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanIntegrationTest.java b/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanIntegrationTest.java
index c3c5ad44de..580edade77 100644
--- a/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanIntegrationTest.java
+++ b/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanIntegrationTest.java
@@ -19,25 +19,27 @@ import static com.jayway.awaitility.Awaitility.to;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
-
@RunWith(Arquillian.class)
public class ScheduleTimerBeanIntegrationTest {
- final static long TIMEOUT = 5000l;
- final static long TOLERANCE = 1000l;
+ private final static long TIMEOUT = 5000l;
+ private final static long TOLERANCE = 1000l;
- @Inject
- TimerEventListener timerEventListener;
+ @Inject TimerEventListener timerEventListener;
@Deployment
public static WebArchive deploy() {
- File[] jars = Maven.resolver().loadPomFromFile("pom.xml")
- .resolve("com.jayway.awaitility:awaitility")
- .withTransitivity().asFile();
+ File[] jars = Maven
+ .resolver()
+ .loadPomFromFile("pom.xml")
+ .resolve("com.jayway.awaitility:awaitility")
+ .withTransitivity()
+ .asFile();
- return ShrinkWrap.create(WebArchive.class)
- .addAsLibraries(jars)
- .addClasses(WithinWindowMatcher.class, TimerEvent.class, TimerEventListener.class, ScheduleTimerBean.class);
+ return ShrinkWrap
+ .create(WebArchive.class)
+ .addAsLibraries(jars)
+ .addClasses(WithinWindowMatcher.class, TimerEvent.class, TimerEventListener.class, ScheduleTimerBean.class);
}
@Test
@@ -46,9 +48,15 @@ public class ScheduleTimerBeanIntegrationTest {
Awaitility.setDefaultTimeout(30, TimeUnit.SECONDS);
await().untilCall(to(timerEventListener.getEvents()).size(), equalTo(3));
- TimerEvent firstEvent = timerEventListener.getEvents().get(0);
- TimerEvent secondEvent = timerEventListener.getEvents().get(1);
- TimerEvent thirdEvent = timerEventListener.getEvents().get(2);
+ TimerEvent firstEvent = timerEventListener
+ .getEvents()
+ .get(0);
+ TimerEvent secondEvent = timerEventListener
+ .getEvents()
+ .get(1);
+ TimerEvent thirdEvent = timerEventListener
+ .getEvents()
+ .get(2);
long delay = secondEvent.getTime() - firstEvent.getTime();
assertThat(delay, Matchers.is(WithinWindowMatcher.withinWindow(TIMEOUT, TOLERANCE)));
diff --git a/jhipster/.editorconfig b/jhipster/.editorconfig
new file mode 100644
index 0000000000..a03599dd04
--- /dev/null
+++ b/jhipster/.editorconfig
@@ -0,0 +1,24 @@
+# EditorConfig helps developers define and maintain consistent
+# coding styles between different editors and IDEs
+# editorconfig.org
+
+root = true
+
+[*]
+
+# Change these settings to your own preference
+indent_style = space
+indent_size = 4
+
+# We recommend you to keep these unchanged
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[{package,bower}.json]
+indent_style = space
+indent_size = 2
diff --git a/jhipster/.gitattributes b/jhipster/.gitattributes
new file mode 100644
index 0000000000..2a13efa88f
--- /dev/null
+++ b/jhipster/.gitattributes
@@ -0,0 +1,22 @@
+# All text files should have the "lf" (Unix) line endings
+* text eol=lf
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.java text
+*.js text
+*.css text
+*.html text
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.jpg binary
+*.jar binary
+*.pdf binary
+*.eot binary
+*.ttf binary
+*.gzip binary
+*.gz binary
+*.ai binary
+*.eps binary
+*.swf binary
diff --git a/jhipster/.gitignore b/jhipster/.gitignore
new file mode 100644
index 0000000000..c9f735a496
--- /dev/null
+++ b/jhipster/.gitignore
@@ -0,0 +1,143 @@
+######################
+# Project Specific
+######################
+/src/main/webapp/content/css/main.css
+/target/www/**
+/src/test/javascript/coverage/
+/src/test/javascript/PhantomJS*/
+
+######################
+# Node
+######################
+/node/
+node_tmp/
+node_modules/
+npm-debug.log.*
+
+######################
+# SASS
+######################
+.sass-cache/
+
+######################
+# Eclipse
+######################
+*.pydevproject
+.project
+.metadata
+tmp/
+tmp/**/*
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+.factorypath
+/src/main/resources/rebel.xml
+
+# External tool builders
+.externalToolBuilders/**
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+######################
+# Intellij
+######################
+.idea/
+*.iml
+*.iws
+*.ipr
+*.ids
+*.orig
+
+######################
+# Visual Studio Code
+######################
+.vscode/
+
+######################
+# Maven
+######################
+/log/
+/target/
+
+######################
+# Gradle
+######################
+.gradle/
+/build/
+
+######################
+# Package Files
+######################
+*.jar
+*.war
+*.ear
+*.db
+
+######################
+# Windows
+######################
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+######################
+# Mac OSX
+######################
+.DS_Store
+.svn
+
+# Thumbnails
+._*
+
+# Files that might appear on external disk
+.Spotlight-V100
+.Trashes
+
+######################
+# Directories
+######################
+/bin/
+/deploy/
+
+######################
+# Logs
+######################
+*.log
+
+######################
+# Others
+######################
+*.class
+*.*~
+*~
+.merge_file*
+
+######################
+# Gradle Wrapper
+######################
+!gradle/wrapper/gradle-wrapper.jar
+
+######################
+# Maven Wrapper
+######################
+!.mvn/wrapper/maven-wrapper.jar
+
+######################
+# ESLint
+######################
+.eslintcache
+/.apt_generated/
diff --git a/jhipster/.gitlab-ci.yml b/jhipster/.gitlab-ci.yml
new file mode 100644
index 0000000000..1cf574251a
--- /dev/null
+++ b/jhipster/.gitlab-ci.yml
@@ -0,0 +1,56 @@
+
+cache:
+ key: "$CI_BUILD_REF_NAME"
+ paths:
+ - node_modules
+ - .maven
+stages:
+ - build
+ - test
+ - package
+
+before_script:
+ - export MAVEN_USER_HOME=`pwd`/.maven
+ - chmod +x mvnw
+ - ./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v6.10.0 -DnpmVersion=4.3.0
+ - ./mvnw com.github.eirslett:frontend-maven-plugin:npm
+
+maven-build:
+ stage: build
+ script: ./mvnw compile -Dmaven.repo.local=$MAVEN_USER_HOME
+
+maven-test:
+ stage: test
+ script:
+ - ./mvnw test -Dmaven.repo.local=$MAVEN_USER_HOME
+ artifacts:
+ paths:
+ - target/surefire-reports/*
+maven-front-test:
+ stage: test
+ script:
+ - ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dfrontend.yarn.arguments=test
+ artifacts:
+ paths:
+ - target/test-results/karma/*
+gatling-test:
+ stage: test
+ allow_failure: true
+ script:
+ - ./mvnw gatling:execute -Dmaven.repo.local=$MAVEN_USER_HOME
+ before_script:
+ - export MAVEN_USER_HOME=`pwd`/.maven
+ - chmod +x mvnw
+ - ./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v6.10.0 -DnpmVersion=4.3.0
+ - ./mvnw com.github.eirslett:frontend-maven-plugin:npm
+ - ./mvnw &
+ artifacts:
+ paths:
+ - target/gatling/*
+maven-package:
+ stage: package
+ script:
+ - ./mvnw package -Pprod -DskipTests -Dmaven.repo.local=$MAVEN_USER_HOME
+ artifacts:
+ paths:
+ - target/*.war
diff --git a/jhipster/.jhipster/Comment.json b/jhipster/.jhipster/Comment.json
new file mode 100644
index 0000000000..c6022daa60
--- /dev/null
+++ b/jhipster/.jhipster/Comment.json
@@ -0,0 +1,39 @@
+{
+ "fluentMethods": true,
+ "relationships": [
+ {
+ "relationshipName": "post",
+ "otherEntityName": "post",
+ "relationshipType": "many-to-one",
+ "relationshipValidateRules": [
+ "required"
+ ],
+ "otherEntityField": "title"
+ }
+ ],
+ "fields": [
+ {
+ "fieldName": "text",
+ "fieldType": "String",
+ "fieldValidateRules": [
+ "required",
+ "minlength",
+ "maxlength"
+ ],
+ "fieldValidateRulesMinlength": "10",
+ "fieldValidateRulesMaxlength": "100"
+ },
+ {
+ "fieldName": "creationDate",
+ "fieldType": "LocalDate",
+ "fieldValidateRules": [
+ "required"
+ ]
+ }
+ ],
+ "changelogDate": "20170316224021",
+ "dto": "no",
+ "service": "no",
+ "entityTableName": "comment",
+ "pagination": "infinite-scroll"
+}
diff --git a/jhipster/.jhipster/Post.json b/jhipster/.jhipster/Post.json
new file mode 100644
index 0000000000..595cf43598
--- /dev/null
+++ b/jhipster/.jhipster/Post.json
@@ -0,0 +1,52 @@
+{
+ "fluentMethods": true,
+ "relationships": [
+ {
+ "relationshipName": "creator",
+ "otherEntityName": "user",
+ "relationshipType": "many-to-one",
+ "relationshipValidateRules": [
+ "required"
+ ],
+ "otherEntityField": "login",
+ "ownerSide": true,
+ "otherEntityRelationshipName": "post"
+ }
+ ],
+ "fields": [
+ {
+ "fieldName": "title",
+ "fieldType": "String",
+ "fieldValidateRules": [
+ "required",
+ "minlength",
+ "maxlength"
+ ],
+ "fieldValidateRulesMinlength": "10",
+ "fieldValidateRulesMaxlength": "100"
+ },
+ {
+ "fieldName": "content",
+ "fieldType": "String",
+ "fieldValidateRules": [
+ "required",
+ "minlength",
+ "maxlength"
+ ],
+ "fieldValidateRulesMinlength": "10",
+ "fieldValidateRulesMaxlength": "1000"
+ },
+ {
+ "fieldName": "creationDate",
+ "fieldType": "LocalDate",
+ "fieldValidateRules": [
+ "required"
+ ]
+ }
+ ],
+ "changelogDate": "20170316223211",
+ "dto": "no",
+ "service": "no",
+ "entityTableName": "post",
+ "pagination": "infinite-scroll"
+}
diff --git a/jhipster/.mvn/wrapper/maven-wrapper.jar b/jhipster/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 0000000000..5fd4d5023f
Binary files /dev/null and b/jhipster/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/jhipster/.mvn/wrapper/maven-wrapper.properties b/jhipster/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000000..c954cec91c
--- /dev/null
+++ b/jhipster/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
diff --git a/jhipster/.travis.yml b/jhipster/.travis.yml
new file mode 100644
index 0000000000..c34d1a7da6
--- /dev/null
+++ b/jhipster/.travis.yml
@@ -0,0 +1,41 @@
+os:
+ - linux
+services:
+ - docker
+language: node_js
+node_js:
+ - "6.10.0"
+jdk:
+ - oraclejdk8
+sudo: false
+cache:
+ directories:
+ - node
+ - node_modules
+ - $HOME/.m2
+env:
+ global:
+ - NODE_VERSION=6.10.0
+ - SPRING_OUTPUT_ANSI_ENABLED=ALWAYS
+ - SPRING_JPA_SHOW_SQL=false
+before_install:
+ - jdk_switcher use oraclejdk8
+ - java -version
+ - sudo /etc/init.d/mysql stop
+ - sudo /etc/init.d/postgresql stop
+ - nvm install $NODE_VERSION
+ - npm install -g npm
+ - node -v
+ - npm -v
+install:
+ - npm install
+script:
+ - chmod +x mvnw
+ - ./mvnw clean test
+ - npm test
+ - ./mvnw package -Pprod -DskipTests
+notifications:
+ webhooks:
+ on_success: change # options: [always|never|change] default: always
+ on_failure: always # options: [always|never|change] default: always
+ on_start: false # default: false
diff --git a/jhipster/.yo-rc.json b/jhipster/.yo-rc.json
new file mode 100644
index 0000000000..155e33b1c5
--- /dev/null
+++ b/jhipster/.yo-rc.json
@@ -0,0 +1,36 @@
+{
+ "generator-jhipster": {
+ "jhipsterVersion": "4.0.8",
+ "baseName": "baeldung",
+ "packageName": "com.baeldung",
+ "packageFolder": "com/baeldung",
+ "serverPort": "8080",
+ "authenticationType": "jwt",
+ "hibernateCache": "ehcache",
+ "clusteredHttpSession": false,
+ "websocket": false,
+ "databaseType": "sql",
+ "devDatabaseType": "h2Disk",
+ "prodDatabaseType": "mysql",
+ "searchEngine": false,
+ "messageBroker": false,
+ "serviceDiscoveryType": false,
+ "buildTool": "maven",
+ "enableSocialSignIn": false,
+ "jwtSecretKey": "e1d4b69d3f953e3fa622121e882e6f459ca20ca4",
+ "clientFramework": "angular2",
+ "useSass": true,
+ "clientPackageManager": "npm",
+ "applicationType": "monolith",
+ "testFrameworks": [
+ "gatling",
+ "protractor"
+ ],
+ "jhiPrefix": "jhi",
+ "enableTranslation": true,
+ "nativeLanguage": "en",
+ "languages": [
+ "en"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/jhipster/Jenkinsfile b/jhipster/Jenkinsfile
new file mode 100644
index 0000000000..1f0873a472
--- /dev/null
+++ b/jhipster/Jenkinsfile
@@ -0,0 +1,50 @@
+#!/usr/bin/env groovy
+
+node {
+ stage('checkout') {
+ checkout scm
+ }
+
+ stage('check java') {
+ sh "java -version"
+ }
+
+ stage('clean') {
+ sh "chmod +x mvnw"
+ sh "./mvnw clean"
+ }
+
+ stage('install tools') {
+ sh "./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v6.10.0 -DnpmVersion=4.3.0"
+ }
+
+ stage('npm install') {
+ sh "./mvnw com.github.eirslett:frontend-maven-plugin:npm"
+ }
+
+ stage('backend tests') {
+ try {
+ sh "./mvnw test"
+ } catch(err) {
+ throw err
+ } finally {
+ junit '**/target/surefire-reports/TEST-*.xml'
+ }
+ }
+
+ stage('frontend tests') {
+ try {
+ sh "./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dfrontend.yarn.arguments=test"
+ } catch(err) {
+ throw err
+ } finally {
+ junit '**/target/test-results/karma/TESTS-*.xml'
+ }
+ }
+
+ stage('packaging') {
+ sh "./mvnw package -Pprod -DskipTests"
+ archiveArtifacts artifacts: '**/target/*.war', fingerprint: true
+ }
+
+}
diff --git a/jhipster/README.md b/jhipster/README.md
new file mode 100644
index 0000000000..d45796d867
--- /dev/null
+++ b/jhipster/README.md
@@ -0,0 +1,153 @@
+# baeldung
+This application was generated using JHipster 4.0.8, you can find documentation and help at [https://jhipster.github.io/documentation-archive/v4.0.8](https://jhipster.github.io/documentation-archive/v4.0.8).
+
+## Development
+
+Before you can build this project, you must install and configure the following dependencies on your machine:
+
+1. [Node.js][]: We use Node to run a development web server and build the project.
+ Depending on your system, you can install Node either from source or as a pre-packaged bundle.
+
+After installing Node, you should be able to run the following command to install development tools.
+You will only need to run this command when dependencies change in [package.json](package.json).
+
+ npm install
+
+We use npm scripts and [Webpack][] as our build system.
+
+
+Run the following commands in two separate terminals to create a blissful development experience where your browser
+auto-refreshes when files change on your hard drive.
+
+ ./mvnw
+ npm start
+
+[Npm][] is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by
+specifying a newer version in [package.json](package.json). You can also run `npm update` and `npm install` to manage dependencies.
+Add the `help` flag on any command to see how you can use it. For example, `npm help update`.
+
+The `npm run` command will list all of the scripts available to run for this project.
+
+### Managing dependencies
+
+For example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command:
+
+ npm install --save --save-exact leaflet
+
+To benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command:
+
+ npm install --save-dev --save-exact @types/leaflet
+
+Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them:
+
+Edit [src/main/webapp/app/vendor.ts](src/main/webapp/app/vendor.ts) file:
+~~~
+import 'leaflet/dist/leaflet.js';
+~~~
+
+Edit [src/main/webapp/content/css/vendor.css](src/main/webapp/content/css/vendor.css) file:
+~~~
+@import '~leaflet/dist/leaflet.css';
+~~~
+
+Note: there are still few other things remaining to do for Leaflet that we won't detail here.
+
+For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][].
+
+### Using angular-cli
+
+You can also use [Angular CLI][] to generate some custom client code.
+
+For example, the following command:
+
+ ng generate component my-component
+
+will generate few files:
+
+ create src/main/webapp/app/my-component/my-component.component.html
+ create src/main/webapp/app/my-component/my-component.component.ts
+ update src/main/webapp/app/app.module.ts
+
+## Building for production
+
+To optimize the baeldung application for production, run:
+
+ ./mvnw -Pprod clean package
+
+This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files.
+To ensure everything worked, run:
+
+ java -jar target/*.war
+
+Then navigate to [http://localhost:8080](http://localhost:8080) in your browser.
+
+Refer to [Using JHipster in production][] for more details.
+
+## Testing
+
+To launch your application's tests, run:
+
+ ./mvnw clean test
+
+### Client tests
+
+Unit tests are run by [Karma][] and written with [Jasmine][]. They're located in [src/test/javascript/](src/test/javascript/) and can be run with:
+
+ npm test
+
+UI end-to-end tests are powered by [Protractor][], which is built on top of WebDriverJS. They're located in [src/test/javascript/e2e](src/test/javascript/e2e)
+and can be run by starting Spring Boot in one terminal (`./mvnw spring-boot:run`) and running the tests (`gulp itest`) in a second one.
+### Other tests
+
+Performance tests are run by [Gatling][] and written in Scala. They're located in [src/test/gatling](src/test/gatling) and can be run with:
+
+ ./mvnw gatling:execute
+
+For more information, refer to the [Running tests page][].
+
+## Using Docker to simplify development (optional)
+
+You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services.
+For example, to start a mysql database in a docker container, run:
+
+ docker-compose -f src/main/docker/mysql.yml up -d
+
+To stop it and remove the container, run:
+
+ docker-compose -f src/main/docker/mysql.yml down
+
+You can also fully dockerize your application and all the services that it depends on.
+To achieve this, first build a docker image of your app by running:
+
+ ./mvnw package -Pprod docker:build
+
+Then run:
+
+ docker-compose -f src/main/docker/app.yml up -d
+
+For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`yo jhipster:docker-compose`), which is able to generate docker configurations for one or several JHipster applications.
+
+## Continuous Integration (optional)
+
+To configure CI for your project, run the ci-cd sub-generator (`yo jhipster:ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.
+
+[JHipster Homepage and latest documentation]: https://jhipster.github.io
+[JHipster 4.0.8 archive]: https://jhipster.github.io/documentation-archive/v4.0.8
+
+[Using JHipster in development]: https://jhipster.github.io/documentation-archive/v4.0.8/development/
+[Using Docker and Docker-Compose]: https://jhipster.github.io/documentation-archive/v4.0.8/docker-compose
+[Using JHipster in production]: https://jhipster.github.io/documentation-archive/v4.0.8/production/
+[Running tests page]: https://jhipster.github.io/documentation-archive/v4.0.8/running-tests/
+[Setting up Continuous Integration]: https://jhipster.github.io/documentation-archive/v4.0.8/setting-up-ci/
+
+[Gatling]: http://gatling.io/
+[Node.js]: https://nodejs.org/
+[Yarn]: https://yarnpkg.org/
+[Webpack]: https://webpack.github.io/
+[Angular CLI]: https://cli.angular.io/
+[BrowserSync]: http://www.browsersync.io/
+[Karma]: http://karma-runner.github.io/
+[Jasmine]: http://jasmine.github.io/2.0/introduction.html
+[Protractor]: https://angular.github.io/protractor/
+[Leaflet]: http://leafletjs.com/
+[DefinitelyTyped]: http://definitelytyped.org/
diff --git a/jhipster/angular-cli.json b/jhipster/angular-cli.json
new file mode 100644
index 0000000000..15558a2fae
--- /dev/null
+++ b/jhipster/angular-cli.json
@@ -0,0 +1,55 @@
+{
+ "project": {
+ "version": "1.0.0-beta.24",
+ "name": "baeldung"
+ },
+ "apps": [
+ {
+ "root": "src/main/webapp/",
+ "outDir": "target/www/app",
+ "assets": [
+ "content",
+ "favicon.ico"
+ ],
+ "index": "index.html",
+ "main": "app/app.main.ts",
+ "test": "",
+ "tsconfig": "../../../tsconfig.json",
+ "prefix": "jhi",
+ "mobile": false,
+ "styles": [
+ "content/css/main.css"
+ ],
+ "scripts": [],
+ "environments": {}
+ }
+ ],
+ "addons": [],
+ "packages": [],
+ "e2e": {
+ "protractor": {
+ "config": "src/test/javascript/protractor.conf.js"
+ }
+ },
+ "test": {
+ "karma": {
+ "config": "src/test/javascript/karma.conf.js"
+ }
+ },
+ "defaults": {
+ "styleExt": "css",
+ "prefixInterfaces": false,
+ "inline": {
+ "style": true,
+ "template": false
+ },
+ "spec": {
+ "class": false,
+ "component": false,
+ "directive": false,
+ "module": false,
+ "pipe": false,
+ "service": false
+ }
+ }
+}
diff --git a/jhipster/circle.yml b/jhipster/circle.yml
new file mode 100644
index 0000000000..bc9371e94f
--- /dev/null
+++ b/jhipster/circle.yml
@@ -0,0 +1,25 @@
+machine:
+ services:
+ - docker
+ java:
+ version: oraclejdk8
+ node:
+ version: 6.10.0
+dependencies:
+ cache_directories:
+ - node
+ - node_modules
+ - ~/.m2
+ override:
+ - java -version
+ - npm install -g npm
+ - node -v
+ - npm -v
+ - java -version
+ - npm install
+test:
+ override:
+ - chmod +x mvnw
+ - ./mvnw clean test
+ - npm test
+ - ./mvnw package -Pprod -DskipTests
diff --git a/jhipster/mvnw b/jhipster/mvnw
new file mode 100755
index 0000000000..a1ba1bf554
--- /dev/null
+++ b/jhipster/mvnw
@@ -0,0 +1,233 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ #
+ # Look for the Apple JDKs first to preserve the existing behaviour, and then look
+ # for the new JDKs provided by Oracle.
+ #
+ if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
+ #
+ # Apple JDKs
+ #
+ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
+ fi
+
+ if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
+ #
+ # Apple JDKs
+ #
+ export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
+ fi
+
+ if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
+ #
+ # Oracle JDKs
+ #
+ export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
+ fi
+
+ if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
+ #
+ # Apple JDKs
+ #
+ export JAVA_HOME=`/usr/libexec/java_home`
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Migwn, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+ # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`which java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+ local basedir=$(pwd)
+ local wdir=$(pwd)
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ wdir=$(cd "$wdir/.."; pwd)
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} "$@"
diff --git a/jhipster/mvnw.cmd b/jhipster/mvnw.cmd
new file mode 100644
index 0000000000..2b934e89dd
--- /dev/null
+++ b/jhipster/mvnw.cmd
@@ -0,0 +1,145 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+set MAVEN_CMD_LINE_ARGS=%*
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+
+set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar""
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%
\ No newline at end of file
diff --git a/jhipster/package.json b/jhipster/package.json
new file mode 100644
index 0000000000..40bbd28799
--- /dev/null
+++ b/jhipster/package.json
@@ -0,0 +1,112 @@
+{
+ "name": "baeldung",
+ "version": "0.0.0",
+ "description": "Description for baeldung",
+ "private": true,
+ "cacheDirectories": [
+ "node_modules"
+ ],
+ "dependencies": {
+ "@angular/common": "2.4.7",
+ "@angular/compiler": "2.4.7",
+ "@angular/core": "2.4.7",
+ "@angular/forms": "2.4.7",
+ "@angular/http": "2.4.7",
+ "@angular/platform-browser": "2.4.7",
+ "@angular/platform-browser-dynamic": "2.4.7",
+ "@angular/router": "3.4.7",
+ "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.20",
+ "angular2-infinite-scroll": "0.3.0",
+ "bootstrap": "4.0.0-alpha.6",
+ "font-awesome": "4.7.0",
+ "angular2-cookie": "1.2.6",
+ "core-js": "2.4.1",
+ "jquery": "3.1.1",
+ "ng-jhipster": "0.1.9",
+ "ng2-webstorage": "1.5.0",
+ "reflect-metadata": "0.1.9",
+ "rxjs": "5.1.0",
+ "swagger-ui": "2.2.10",
+ "tether": "1.4.0",
+ "zone.js": "0.7.6"
+ },
+ "devDependencies": {
+ "@angular/cli": "1.0.0-beta.28.3",
+ "@types/jasmine": "2.5.42",
+ "@types/node": "7.0.5",
+ "@types/selenium-webdriver": "2.53.39",
+ "add-asset-html-webpack-plugin": "1.0.2",
+ "angular2-template-loader": "0.6.2",
+ "awesome-typescript-loader": "3.0.7",
+ "browser-sync": "2.18.7",
+ "browser-sync-webpack-plugin": "1.1.4",
+ "codelyzer": "2.0.0",
+ "copy-webpack-plugin": "4.0.1",
+ "css-loader": "0.26.1",
+ "del": "2.2.2",
+ "event-stream": "3.3.4",
+ "exports-loader": "0.6.3",
+ "extract-text-webpack-plugin": "2.0.0-beta.5",
+ "file-loader": "0.10.0",
+ "generator-jhipster": "4.0.8",
+ "html-webpack-plugin": "2.28.0",
+ "image-webpack-loader": "3.2.0",
+ "jasmine-core": "2.5.2",
+ "jasmine-reporters": "2.2.0",
+ "karma": "1.4.1",
+ "karma-chrome-launcher": "2.0.0",
+ "karma-coverage": "1.1.1",
+ "karma-intl-shim": "1.0.3",
+ "karma-jasmine": "1.1.0",
+ "karma-junit-reporter": "1.2.0",
+ "karma-phantomjs-launcher": "1.0.2",
+ "karma-remap-istanbul": "0.6.0",
+ "karma-sourcemap-loader": "0.3.7",
+ "karma-webpack": "2.0.2",
+ "lazypipe": "1.0.1",
+ "lodash": "4.17.4",
+ "map-stream": "0.0.6",
+ "phantomjs-prebuilt": "2.1.14",
+ "protractor": "5.1.1",
+ "protractor-jasmine2-screenshot-reporter": "0.3.3",
+ "ts-node": "2.1.0",
+ "proxy-middleware": "0.15.0",
+ "raw-loader": "0.5.1",
+ "run-sequence": "1.2.2",
+ "sourcemap-istanbul-instrumenter-loader": "0.2.0",
+ "string-replace-webpack-plugin": "0.0.5",
+ "style-loader": "0.13.1",
+ "to-string-loader": "1.1.5",
+ "tslint": "4.4.2",
+ "tslint-loader": "3.4.1",
+ "typescript": "2.1.6",
+ "webpack": "2.2.1",
+ "webpack-dev-server": "2.3.0",
+ "webpack-merge": "2.6.1",
+ "webpack-visualizer-plugin": "0.1.10",
+ "write-file-webpack-plugin": "3.4.2",
+ "xml2js": "0.4.17",
+ "sass-loader": "5.0.1",
+ "node-sass": "4.5.0",
+ "postcss-loader": "1.3.0",
+ "yargs": "6.6.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "scripts": {
+ "lint": "tslint 'src/main/webapp/app/**/*.ts' --force",
+ "lint:fix": "tslint 'src/main/webapp/app/**/*.ts' --fix --force",
+ "tsc": "tsc",
+ "tsc:w": "tsc -w",
+ "start": "npm run webpack:dev",
+ "webpack:build": "webpack --config webpack/webpack.vendor.js && webpack --config webpack/webpack.dev.js",
+ "webpack:build:dev": "webpack --config webpack/webpack.dev.js",
+ "webpack:dev": "webpack-dev-server --config webpack/webpack.dev.js --progress --inline --hot --profile --port=9060",
+ "webpack:prod": "npm test && webpack -p --config webpack/webpack.vendor.js && webpack -p --config webpack/webpack.prod.js",
+ "test": "npm run lint && karma start src/test/javascript/karma.conf.js",
+ "test:watch": "karma start --watch",
+ "e2e": "protractor src/test/javascript/protractor.conf.js",
+ "postinstall": "webdriver-manager update && npm run webpack:build"
+ }
+}
diff --git a/jhipster/pom.xml b/jhipster/pom.xml
new file mode 100644
index 0000000000..ba78ad4e2b
--- /dev/null
+++ b/jhipster/pom.xml
@@ -0,0 +1,1034 @@
+
+
+ 4.0.0
+
+
+ spring-boot-starter-parent
+ org.springframework.boot
+ 1.5.2.RELEASE
+
+
+
+ com.baeldung
+ jhipster-monolithic
+ 0.0.1-SNAPSHOT
+ war
+ JHipster Monolithic Application
+
+
+ ${maven.version}
+
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-hibernate5
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-hppc
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-json-org
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+
+
+ com.h2database
+ h2
+
+
+ com.jayway.jsonpath
+ json-path
+ test
+
+
+
+ com.jcraft
+ jzlib
+ ${jzlib.version}
+
+
+ com.mattbertolini
+ liquibase-slf4j
+ ${liquibase-slf4j.version}
+
+
+ com.ryantenney.metrics
+ metrics-spring
+ ${metrics-spring.version}
+
+
+ metrics-annotation
+ com.codahale.metrics
+
+
+ metrics-core
+ com.codahale.metrics
+
+
+ metrics-healthchecks
+ com.codahale.metrics
+
+
+
+
+ com.zaxxer
+ HikariCP
+
+
+ tools
+ com.sun
+
+
+
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+
+
+ io.dropwizard.metrics
+ metrics-annotation
+ ${dropwizard-metrics.version}
+
+
+ io.dropwizard.metrics
+ metrics-core
+
+
+ io.dropwizard.metrics
+ metrics-json
+ ${dropwizard-metrics.version}
+
+
+ io.dropwizard.metrics
+ metrics-jvm
+ ${dropwizard-metrics.version}
+
+
+ io.dropwizard.metrics
+ metrics-servlet
+ ${dropwizard-metrics.version}
+
+
+ io.dropwizard.metrics
+ metrics-servlets
+
+
+ io.gatling.highcharts
+ gatling-charts-highcharts
+ ${gatling.version}
+ test
+
+
+ io.github.jhipster
+ jhipster
+ ${jhipster.server.version}
+
+
+ io.jsonwebtoken
+ jjwt
+ ${jjwt.version}
+
+
+ io.springfox
+ springfox-bean-validators
+ ${springfox.version}
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox.version}
+
+
+ mapstruct
+ org.mapstruct
+
+
+
+
+ javax.cache
+ cache-api
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ net.logstash.logback
+ logstash-logback-encoder
+ ${logstash-logback-encoder.version}
+
+
+ logback-core
+ ch.qos.logback
+
+
+ logback-classic
+ ch.qos.logback
+
+
+ logback-access
+ ch.qos.logback
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang.version}
+
+
+ org.assertj
+ assertj-core
+ test
+
+
+ org.awaitility
+ awaitility
+ ${awaitility.version}
+ test
+
+
+ org.ehcache
+ ehcache
+
+
+ org.hibernate
+ hibernate-envers
+
+
+ org.hibernate
+ hibernate-jcache
+ ${hibernate.version}
+
+
+ org.hibernate
+ hibernate-validator
+
+
+ org.liquibase
+ liquibase-core
+
+
+ jetty-servlet
+ org.eclipse.jetty
+
+
+
+
+ org.mapstruct
+ mapstruct-jdk8
+ ${mapstruct.version}
+
+
+ org.springframework
+ spring-context-support
+
+
+ org.springframework.boot
+ spring-boot-actuator
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+ org.springframework.boot
+ spring-boot-loader-tools
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+ org.springframework.boot
+ spring-boot-starter-cloud-connectors
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ spring-boot-starter-tomcat
+ org.springframework.boot
+
+
+
+
+ org.springframework.boot
+ spring-boot-test
+ test
+
+
+
+ org.springframework.security
+ spring-security-data
+
+
+ org.springframework.security
+ spring-security-test
+ test
+
+
+
+
+ spring-boot:run
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+ prepare-agent
+
+
+
+
+
+
+
+
+ com.github.eirslett
+ frontend-maven-plugin
+ ${frontend-maven-plugin.version}
+
+ install-node-and-npm
+ npm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ com.github.ekryd.sortpom
+ sortpom-maven-plugin
+ ${sortpom-maven-plugin.version}
+
+
+ verify
+
+ sort
+
+
+
+
+ true
+ 4
+ groupId,artifactId
+ groupId,artifactId
+ true
+ false
+
+
+
+ com.spotify
+ docker-maven-plugin
+ ${docker-maven-plugin.version}
+
+ baeldung
+ src/main/docker
+
+
+ /
+ ${project.build.directory}
+ ${project.build.finalName}.war
+
+
+
+
+
+ io.gatling
+ gatling-maven-plugin
+ ${gatling-maven-plugin.version}
+
+ src/test/gatling/conf
+ src/test/gatling/data
+ target/gatling/results
+ src/test/gatling/bodies
+ src/test/gatling/simulations
+
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ 1.8
+ 1.8
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${mapstruct.version}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-eclipse-plugin
+
+ true
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ ${maven-enforcer-plugin.version}
+
+
+ enforce-versions
+
+ enforce
+
+
+
+
+
+
+ You are running an older version of
+ Maven. JHipster requires at least Maven
+ ${maven.version}
+ [${maven.version},)
+
+
+ You are running an older version of
+ Java. JHipster requires at least JDK
+ ${java.version}
+ [${java.version}.0,)
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ ${maven-resources-plugin.version}
+
+
+ default-resources
+ validate
+
+ copy-resources
+
+
+ target/classes
+ false
+
+ #
+
+
+
+ src/main/resources/
+ true
+
+ **/*.xml
+ **/*.yml
+
+
+
+ src/main/resources/
+ false
+
+ **/*.xml
+ **/*.yml
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ alphabetical
+
+ **/*IntTest.java
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+
+ pre-unit-tests
+
+ prepare-agent
+
+
+
+ ${project.testresult.directory}/coverage/jacoco/jacoco.exec
+
+
+
+
+ post-unit-test
+ test
+
+ report
+
+
+ ${project.testresult.directory}/coverage/jacoco/jacoco.exec
+ ${project.testresult.directory}/coverage/jacoco
+
+
+
+
+
+ org.liquibase
+ liquibase-maven-plugin
+ ${liquibase.version}
+
+
+ javax.validation
+ validation-api
+ ${validation-api.version}
+
+
+ org.javassist
+ javassist
+ ${javassist.version}
+
+
+ org.liquibase.ext
+ liquibase-hibernate5
+ ${liquibase-hibernate5.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+ ${project.parent.version}
+
+
+
+ src/main/resources/config/liquibase/master.xml
+ src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml
+ org.h2.Driver
+ jdbc:h2:file:./target/h2db/db/baeldung
+
+ baeldung
+
+ hibernate:spring:com.baeldung.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
+ true
+ debug
+
+
+
+ org.sonarsource.scanner.maven
+ sonar-maven-plugin
+ ${sonar-maven-plugin.version}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+ true
+
+
+
+
+
+
+
+
+ no-liquibase
+
+ ,no-liquibase
+
+
+
+ swagger
+
+ ,swagger
+
+
+
+ webpack
+
+
+
+ com.github.eirslett
+ frontend-maven-plugin
+ ${frontend-maven-plugin.version}
+
+
+ install node and npm
+
+ install-node-and-npm
+
+
+ ${node.version}
+ ${npm.version}
+
+
+
+ webpack build dev
+ generate-resources
+
+ npm
+
+
+ run webpack:build:dev
+
+
+
+
+
+
+
+
+ dev
+
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ src/main/webapp/
+
+
+
+
+
+
+ DEBUG
+
+ dev${profile.no-liquibase}
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+
+ prod
+
+
+
+ com.github.eirslett
+ frontend-maven-plugin
+ ${frontend-maven-plugin.version}
+
+
+ install node and npm
+
+ install-node-and-npm
+
+
+ ${node.version}
+ ${npm.version}
+
+
+
+ npm install
+
+ npm
+
+
+ install
+
+
+
+ npm rebuild node-sass
+
+ npm
+
+
+ rebuild node-sass
+
+
+
+ webpack build prod
+ generate-resources
+
+ npm
+
+
+ run webpack:prod
+
+
+
+
+
+ maven-clean-plugin
+
+
+
+ target/www/
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ target/www/
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ build-info
+
+
+
+
+ true
+
+
+
+
+
+
+ INFO
+
+ prod${profile.swagger}${profile.no-liquibase}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+
+
+ cc
+
+
+
+ net.alchim31.maven
+ scala-maven-plugin
+ ${scala-maven-plugin.version}
+
+
+ compile
+ compile
+
+ add-source
+ compile
+
+
+
+ test-compile
+ test-compile
+
+ add-source
+ testCompile
+
+
+
+
+ incremental
+ true
+ ${scala.version}
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ default-compile
+ none
+
+
+ default-testCompile
+ none
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ src/main/webapp/
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+ true
+ true
+
+
+
+
+
+
+
+ DEBUG
+
+ dev,swagger
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
+
+
+
+ graphite
+
+
+ io.dropwizard.metrics
+ metrics-graphite
+
+
+
+
+
+ prometheus
+
+
+ io.prometheus
+ simpleclient
+ ${prometheus-simpleclient.version}
+
+
+ io.prometheus
+ simpleclient_dropwizard
+ ${prometheus-simpleclient.version}
+
+
+ io.prometheus
+ simpleclient_servlet
+ ${prometheus-simpleclient.version}
+
+
+
+
+
+ IDE
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${mapstruct.version}
+
+
+
+
+ integration
+
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration-test
+
+ test
+
+
+
+ **/*IntTest.java
+
+
+
+
+
+
+
+
+
+
+
+ -Djava.security.egd=file:/dev/./urandom -Xmx256m
+ 3.6.2
+ 2.0.0
+ 2.5
+ 3.5
+ 0.4.13
+ 1.3
+ 2.2.1
+ 2.2.3
+ 5.2.8.Final
+ 2.6.0
+ 0.7.9
+ 1.8
+ 3.21.0-GA
+ 1.0.0
+ 1.1.0
+ 0.7.0
+ 1.1.3
+ 3.6
+ 2.0.0
+ 4.8
+ jdt_apt
+ 1.1.0.Final
+ 3.6.0
+ 1.4.1
+ 3.0.1
+ yyyyMMddHHmmss
+ ${java.version}
+ ${java.version}
+ 3.0.0
+ 3.1.3
+ v6.10.0
+ 4.3.0
+
+
+
+
+ ${project.build.directory}/test-results
+ 0.0.20
+ false
+ 3.2.2
+ 2.12.1
+ 3.2
+
+ src/main/webapp/content/**/*.*,
+ src/main/webapp/bower_components/**/*.*,
+ src/main/webapp/i18n/*.js, target/www/**/*.*
+
+ S3437,UndocumentedApi,BoldAndItalicTagsCheck
+
+
+ src/main/webapp/app/**/*.*
+ Web:BoldAndItalicTagsCheck
+
+ src/main/java/**/*
+ squid:S3437
+
+ src/main/java/**/*
+ squid:UndocumentedApi
+
+ ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec
+ ${project.testresult.directory}/coverage/jacoco/jacoco.exec
+ jacoco
+
+ ${project.testresult.directory}/karma
+
+ ${project.testresult.directory}/coverage/report-lcov/lcov.info
+
+ ${project.testresult.directory}/coverage/report-lcov/lcov.info
+
+ ${project.basedir}/src/main/
+ ${project.testresult.directory}/surefire-reports
+ ${project.basedir}/src/test/
+
+ 2.5.0
+
+ 2.6.1
+ 1.4.10.Final
+ 1.1.0.Final
+
+
diff --git a/jhipster/postcss.config.js b/jhipster/postcss.config.js
new file mode 100644
index 0000000000..f549c034d5
--- /dev/null
+++ b/jhipster/postcss.config.js
@@ -0,0 +1,3 @@
+module.exports = {
+ plugins: []
+}
diff --git a/jhipster/src/main/docker/Dockerfile b/jhipster/src/main/docker/Dockerfile
new file mode 100644
index 0000000000..66991b2998
--- /dev/null
+++ b/jhipster/src/main/docker/Dockerfile
@@ -0,0 +1,13 @@
+FROM openjdk:8-jre-alpine
+
+ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
+ JHIPSTER_SLEEP=0
+
+# add directly the war
+ADD *.war /app.war
+
+VOLUME /tmp
+EXPOSE 8080
+CMD echo "The application will start in ${JHIPSTER_SLEEP}s..." && \
+ sleep ${JHIPSTER_SLEEP} && \
+ java -Djava.security.egd=file:/dev/./urandom -jar /app.war
diff --git a/jhipster/src/main/docker/app.yml b/jhipster/src/main/docker/app.yml
new file mode 100644
index 0000000000..78cd2c1602
--- /dev/null
+++ b/jhipster/src/main/docker/app.yml
@@ -0,0 +1,14 @@
+version: '2'
+services:
+ baeldung-app:
+ image: baeldung
+ environment:
+ - SPRING_PROFILES_ACTIVE=prod,swagger
+ - SPRING_DATASOURCE_URL=jdbc:mysql://baeldung-mysql:3306/baeldung?useUnicode=true&characterEncoding=utf8&useSSL=false
+ - JHIPSTER_SLEEP=10 # gives time for the database to boot before the application
+ ports:
+ - 8080:8080
+ baeldung-mysql:
+ extends:
+ file: mysql.yml
+ service: baeldung-mysql
diff --git a/jhipster/src/main/docker/mysql.yml b/jhipster/src/main/docker/mysql.yml
new file mode 100644
index 0000000000..5038d09504
--- /dev/null
+++ b/jhipster/src/main/docker/mysql.yml
@@ -0,0 +1,13 @@
+version: '2'
+services:
+ baeldung-mysql:
+ image: mysql:5.7.13
+ # volumes:
+ # - ~/volumes/jhipster/baeldung/mysql/:/var/lib/mysql/
+ environment:
+ - MYSQL_USER=root
+ - MYSQL_ALLOW_EMPTY_PASSWORD=yes
+ - MYSQL_DATABASE=baeldung
+ ports:
+ - 3306:3306
+ command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8
diff --git a/jhipster/src/main/docker/sonar.yml b/jhipster/src/main/docker/sonar.yml
new file mode 100644
index 0000000000..718be83b4d
--- /dev/null
+++ b/jhipster/src/main/docker/sonar.yml
@@ -0,0 +1,7 @@
+version: '2'
+services:
+ baeldung-sonar:
+ image: sonarqube:6.2-alpine
+ ports:
+ - 9000:9000
+ - 9092:9092
diff --git a/jhipster/src/main/java/com/baeldung/ApplicationWebXml.java b/jhipster/src/main/java/com/baeldung/ApplicationWebXml.java
new file mode 100644
index 0000000000..762d18420c
--- /dev/null
+++ b/jhipster/src/main/java/com/baeldung/ApplicationWebXml.java
@@ -0,0 +1,21 @@
+package com.baeldung;
+
+import com.baeldung.config.DefaultProfileUtil;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+
+/**
+ * This is a helper Java class that provides an alternative to creating a web.xml.
+ * This will be invoked only when the application is deployed to a servlet container like Tomcat, JBoss etc.
+ */
+public class ApplicationWebXml extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ /**
+ * set a default to use when no profile is configured.
+ */
+ DefaultProfileUtil.addDefaultProfile(application.application());
+ return application.sources(BaeldungApp.class);
+ }
+}
diff --git a/jhipster/src/main/java/com/baeldung/BaeldungApp.java b/jhipster/src/main/java/com/baeldung/BaeldungApp.java
new file mode 100644
index 0000000000..13b6b2b3fa
--- /dev/null
+++ b/jhipster/src/main/java/com/baeldung/BaeldungApp.java
@@ -0,0 +1,84 @@
+package com.baeldung;
+
+import com.baeldung.config.ApplicationProperties;
+import com.baeldung.config.DefaultProfileUtil;
+
+import io.github.jhipster.config.JHipsterConstants;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.actuate.autoconfigure.*;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.core.env.Environment;
+
+import javax.annotation.PostConstruct;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+
+@ComponentScan
+@EnableAutoConfiguration(exclude = {MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class})
+@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class})
+public class BaeldungApp {
+
+ private static final Logger log = LoggerFactory.getLogger(BaeldungApp.class);
+
+ private final Environment env;
+
+ public BaeldungApp(Environment env) {
+ this.env = env;
+ }
+
+ /**
+ * Initializes baeldung.
+ *
+ * Spring profiles can be configured with a program arguments --spring.profiles.active=your-active-profile
+ *
+ * You can find more information on how profiles work with JHipster on http://jhipster.github.io/profiles/.
+ */
+ @PostConstruct
+ public void initApplication() {
+ Collection activeProfiles = Arrays.asList(env.getActiveProfiles());
+ if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) {
+ log.error("You have misconfigured your application! It should not run " +
+ "with both the 'dev' and 'prod' profiles at the same time.");
+ }
+ if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD)) {
+ log.error("You have misconfigured your application! It should not" +
+ "run with both the 'dev' and 'cloud' profiles at the same time.");
+ }
+ }
+
+ /**
+ * Main method, used to run the application.
+ *
+ * @param args the command line arguments
+ * @throws UnknownHostException if the local host name could not be resolved into an address
+ */
+ public static void main(String[] args) throws UnknownHostException {
+ SpringApplication app = new SpringApplication(BaeldungApp.class);
+ DefaultProfileUtil.addDefaultProfile(app);
+ Environment env = app.run(args).getEnvironment();
+ String protocol = "http";
+ if (env.getProperty("server.ssl.key-store") != null) {
+ protocol = "https";
+ }
+ log.info("\n----------------------------------------------------------\n\t" +
+ "Application '{}' is running! Access URLs:\n\t" +
+ "Local: \t\t{}://localhost:{}\n\t" +
+ "External: \t{}://{}:{}\n\t" +
+ "Profile(s): \t{}\n----------------------------------------------------------",
+ env.getProperty("spring.application.name"),
+ protocol,
+ env.getProperty("server.port"),
+ protocol,
+ InetAddress.getLocalHost().getHostAddress(),
+ env.getProperty("server.port"),
+ env.getActiveProfiles());
+ }
+}
diff --git a/jhipster/src/main/java/com/baeldung/aop/logging/LoggingAspect.java b/jhipster/src/main/java/com/baeldung/aop/logging/LoggingAspect.java
new file mode 100644
index 0000000000..7fbd352820
--- /dev/null
+++ b/jhipster/src/main/java/com/baeldung/aop/logging/LoggingAspect.java
@@ -0,0 +1,79 @@
+package com.baeldung.aop.logging;
+
+import io.github.jhipster.config.JHipsterConstants;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.AfterThrowing;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.env.Environment;
+
+import java.util.Arrays;
+
+/**
+ * Aspect for logging execution of service and repository Spring components.
+ *
+ * By default, it only runs with the "dev" profile.
+ */
+@Aspect
+public class LoggingAspect {
+
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ private final Environment env;
+
+ public LoggingAspect(Environment env) {
+ this.env = env;
+ }
+
+ /**
+ * Pointcut that matches all repositories, services and Web REST endpoints.
+ */
+ @Pointcut("within(com.baeldung.repository..*) || within(com.baeldung.service..*) || within(com.baeldung.web.rest..*)")
+ public void loggingPointcut() {
+ // Method is empty as this is just a Pointcut, the implementations are in the advices.
+ }
+
+ /**
+ * Advice that logs methods throwing exceptions.
+ */
+ @AfterThrowing(pointcut = "loggingPointcut()", throwing = "e")
+ public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
+ if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {
+ log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'", joinPoint.getSignature().getDeclaringTypeName(),
+ joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL", e.getMessage(), e);
+
+ } else {
+ log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(),
+ joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL");
+ }
+ }
+
+ /**
+ * Advice that logs when a method is entered and exited.
+ */
+ @Around("loggingPointcut()")
+ public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
+ if (log.isDebugEnabled()) {
+ log.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(),
+ joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs()));
+ }
+ try {
+ Object result = joinPoint.proceed();
+ if (log.isDebugEnabled()) {
+ log.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(),
+ joinPoint.getSignature().getName(), result);
+ }
+ return result;
+ } catch (IllegalArgumentException e) {
+ log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()),
+ joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
+
+ throw e;
+ }
+ }
+}
diff --git a/jhipster/src/main/java/com/baeldung/config/ApplicationProperties.java b/jhipster/src/main/java/com/baeldung/config/ApplicationProperties.java
new file mode 100644
index 0000000000..add1782678
--- /dev/null
+++ b/jhipster/src/main/java/com/baeldung/config/ApplicationProperties.java
@@ -0,0 +1,15 @@
+package com.baeldung.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Properties specific to JHipster.
+ *
+ *
+ * Properties are configured in the application.yml file.
+ *
+ */
+@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
+public class ApplicationProperties {
+
+}
diff --git a/jhipster/src/main/java/com/baeldung/config/AsyncConfiguration.java b/jhipster/src/main/java/com/baeldung/config/AsyncConfiguration.java
new file mode 100644
index 0000000000..dc1ba37514
--- /dev/null
+++ b/jhipster/src/main/java/com/baeldung/config/AsyncConfiguration.java
@@ -0,0 +1,46 @@
+package com.baeldung.config;
+
+import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor;
+import io.github.jhipster.config.JHipsterProperties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
+import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.*;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+
+@Configuration
+@EnableAsync
+@EnableScheduling
+public class AsyncConfiguration implements AsyncConfigurer {
+
+ private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
+
+ private final JHipsterProperties jHipsterProperties;
+
+ public AsyncConfiguration(JHipsterProperties jHipsterProperties) {
+ this.jHipsterProperties = jHipsterProperties;
+ }
+
+ @Override
+ @Bean(name = "taskExecutor")
+ public Executor getAsyncExecutor() {
+ log.debug("Creating Async Task Executor");
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
+ executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
+ executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
+ executor.setThreadNamePrefix("baeldung-Executor-");
+ return new ExceptionHandlingAsyncTaskExecutor(executor);
+ }
+
+ @Override
+ public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
+ return new SimpleAsyncUncaughtExceptionHandler();
+ }
+}
diff --git a/jhipster/src/main/java/com/baeldung/config/CacheConfiguration.java b/jhipster/src/main/java/com/baeldung/config/CacheConfiguration.java
new file mode 100644
index 0000000000..4323fa076a
--- /dev/null
+++ b/jhipster/src/main/java/com/baeldung/config/CacheConfiguration.java
@@ -0,0 +1,48 @@
+package com.baeldung.config;
+
+import io.github.jhipster.config.JHipsterProperties;
+import org.ehcache.config.builders.CacheConfigurationBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
+import org.ehcache.expiry.Duration;
+import org.ehcache.expiry.Expirations;
+import org.ehcache.jsr107.Eh107Configuration;
+
+import java.util.concurrent.TimeUnit;
+
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.*;
+
+@Configuration
+@EnableCaching
+@AutoConfigureAfter(value = { MetricsConfiguration.class })
+@AutoConfigureBefore(value = { WebConfigurer.class, DatabaseConfiguration.class })
+public class CacheConfiguration {
+
+ private final javax.cache.configuration.Configuration