;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EcommerceComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EcommerceComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.ts
new file mode 100644
index 0000000000..901fdef6e6
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.ts
@@ -0,0 +1,44 @@
+import {Component, OnInit, ViewChild} from '@angular/core';
+import {ProductsComponent} from "./products/products.component";
+import {ShoppingCartComponent} from "./shopping-cart/shopping-cart.component";
+import {OrdersComponent} from "./orders/orders.component";
+
+@Component({
+ selector: 'app-ecommerce',
+ templateUrl: './ecommerce.component.html',
+ styleUrls: ['./ecommerce.component.css']
+})
+export class EcommerceComponent implements OnInit {
+ private collapsed = true;
+ orderFinished = false;
+
+ @ViewChild('productsC')
+ productsC: ProductsComponent;
+
+ @ViewChild('shoppingCartC')
+ shoppingCartC: ShoppingCartComponent;
+
+ @ViewChild('ordersC')
+ ordersC: OrdersComponent;
+
+ constructor() {
+ }
+
+ ngOnInit() {
+ }
+
+ toggleCollapsed(): void {
+ this.collapsed = !this.collapsed;
+ }
+
+ finishOrder(orderFinished: boolean) {
+ this.orderFinished = orderFinished;
+ }
+
+ reset() {
+ this.orderFinished = false;
+ this.productsC.reset();
+ this.shoppingCartC.reset();
+ this.ordersC.paid = false;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-order.model.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-order.model.ts
new file mode 100644
index 0000000000..0e1d9b03c8
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-order.model.ts
@@ -0,0 +1,11 @@
+import {Product} from "./product.model";
+
+export class ProductOrder {
+ product: Product;
+ quantity: number;
+
+ constructor(product: Product, quantity: number) {
+ this.product = product;
+ this.quantity = quantity;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-orders.model.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-orders.model.ts
new file mode 100644
index 0000000000..d6b1f321a9
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-orders.model.ts
@@ -0,0 +1,5 @@
+import {ProductOrder} from "./product-order.model";
+
+export class ProductOrders {
+ productOrders: ProductOrder[] = [];
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product.model.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product.model.ts
new file mode 100644
index 0000000000..258753f62e
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product.model.ts
@@ -0,0 +1,13 @@
+export class Product {
+ id: number;
+ name: string;
+ price: number;
+ pictureUrl: string;
+
+ constructor(id: number, name: string, price: number, pictureUrl: string) {
+ this.id = id;
+ this.name = name;
+ this.price = price;
+ this.pictureUrl = pictureUrl;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.css
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.html
new file mode 100644
index 0000000000..e4a8b50c63
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.html
@@ -0,0 +1,13 @@
+ORDER
+
+ -
+ {{ order.product.name }} - ${{ order.product.price }} x {{ order.quantity}} pcs.
+
+
+Total amount: ${{ total }}
+
+
+
+
+ Congratulation! You successfully made the order.
+
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.spec.ts
new file mode 100644
index 0000000000..b8efbb0f4e
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { OrdersComponent } from './orders.component';
+
+describe('OrdersComponent', () => {
+ let component: OrdersComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ OrdersComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(OrdersComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.ts
new file mode 100644
index 0000000000..c3348ed396
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.ts
@@ -0,0 +1,39 @@
+import {Component, OnInit} from '@angular/core';
+import {ProductOrders} from "../models/product-orders.model";
+import {Subscription} from "rxjs/internal/Subscription";
+import {EcommerceService} from "../services/EcommerceService";
+
+@Component({
+ selector: 'app-orders',
+ templateUrl: './orders.component.html',
+ styleUrls: ['./orders.component.css']
+})
+export class OrdersComponent implements OnInit {
+ orders: ProductOrders;
+ total: number;
+ paid: boolean;
+ sub: Subscription;
+
+ constructor(private ecommerceService: EcommerceService) {
+ this.orders = this.ecommerceService.ProductOrders;
+ }
+
+ ngOnInit() {
+ this.paid = false;
+ this.sub = this.ecommerceService.OrdersChanged.subscribe(() => {
+ this.orders = this.ecommerceService.ProductOrders;
+ });
+ this.loadTotal();
+ }
+
+ pay() {
+ this.paid = true;
+ this.ecommerceService.saveOrder(this.orders).subscribe();
+ }
+
+ loadTotal() {
+ this.sub = this.ecommerceService.TotalChanged.subscribe(() => {
+ this.total = this.ecommerceService.Total;
+ });
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.css
new file mode 100644
index 0000000000..dce4e4caf2
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.css
@@ -0,0 +1,4 @@
+.padding-0 {
+ padding-right: 0;
+ padding-left: 1;
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.html
new file mode 100644
index 0000000000..f9d422b024
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
${{order.product.price}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.spec.ts
new file mode 100644
index 0000000000..563ae953e1
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ProductsComponent } from './products.component';
+
+describe('ProductsComponent', () => {
+ let component: ProductsComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ProductsComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ProductsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.ts
new file mode 100644
index 0000000000..520d0b106a
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.ts
@@ -0,0 +1,82 @@
+import {Component, OnInit} from '@angular/core';
+import {ProductOrder} from "../models/product-order.model";
+import {EcommerceService} from "../services/EcommerceService";
+import {Subscription} from "rxjs/internal/Subscription";
+import {ProductOrders} from "../models/product-orders.model";
+import {Product} from "../models/product.model";
+
+@Component({
+ selector: 'app-products',
+ templateUrl: './products.component.html',
+ styleUrls: ['./products.component.css']
+})
+export class ProductsComponent implements OnInit {
+ productOrders: ProductOrder[] = [];
+ products: Product[] = [];
+ selectedProductOrder: ProductOrder;
+ private shoppingCartOrders: ProductOrders;
+ sub: Subscription;
+ productSelected: boolean = false;
+
+ constructor(private ecommerceService: EcommerceService) {
+ }
+
+ ngOnInit() {
+ this.productOrders = [];
+ this.loadProducts();
+ this.loadOrders();
+ }
+
+ addToCart(order: ProductOrder) {
+ this.ecommerceService.SelectedProductOrder = order;
+ this.selectedProductOrder = this.ecommerceService.SelectedProductOrder;
+ this.productSelected = true;
+ }
+
+ removeFromCart(productOrder: ProductOrder) {
+ let index = this.getProductIndex(productOrder.product);
+ if (index > -1) {
+ this.shoppingCartOrders.productOrders.splice(
+ this.getProductIndex(productOrder.product), 1);
+ }
+ this.ecommerceService.ProductOrders = this.shoppingCartOrders;
+ this.shoppingCartOrders = this.ecommerceService.ProductOrders;
+ this.productSelected = false;
+ }
+
+ getProductIndex(product: Product): number {
+ return this.ecommerceService.ProductOrders.productOrders.findIndex(
+ value => value.product === product);
+ }
+
+ isProductSelected(product: Product): boolean {
+ return this.getProductIndex(product) > -1;
+ }
+
+ loadProducts() {
+ this.ecommerceService.getAllProducts()
+ .subscribe(
+ (products: any[]) => {
+ this.products = products;
+ this.products.forEach(product => {
+ this.productOrders.push(new ProductOrder(product, 0));
+ })
+ },
+ (error) => console.log(error)
+ );
+ }
+
+ loadOrders() {
+ this.sub = this.ecommerceService.OrdersChanged.subscribe(() => {
+ this.shoppingCartOrders = this.ecommerceService.ProductOrders;
+ });
+ }
+
+ reset() {
+ this.productOrders = [];
+ this.loadProducts();
+ this.ecommerceService.ProductOrders.productOrders = [];
+ this.loadOrders();
+ this.productSelected = false;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/services/EcommerceService.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/services/EcommerceService.ts
new file mode 100644
index 0000000000..d22b740c41
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/services/EcommerceService.ts
@@ -0,0 +1,62 @@
+import {ProductOrder} from "../models/product-order.model";
+import {Subject} from "rxjs/internal/Subject";
+import {ProductOrders} from "../models/product-orders.model";
+import {HttpClient} from '@angular/common/http';
+import {Injectable} from "@angular/core";
+
+@Injectable()
+export class EcommerceService {
+ private productsUrl = "/api/products";
+ private ordersUrl = "/api/orders";
+
+ private productOrder: ProductOrder;
+ private orders: ProductOrders = new ProductOrders();
+
+ private productOrderSubject = new Subject();
+ private ordersSubject = new Subject();
+ private totalSubject = new Subject();
+
+ private total: number;
+
+ ProductOrderChanged = this.productOrderSubject.asObservable();
+ OrdersChanged = this.ordersSubject.asObservable();
+ TotalChanged = this.totalSubject.asObservable();
+
+ constructor(private http: HttpClient) {
+ }
+
+ getAllProducts() {
+ return this.http.get(this.productsUrl);
+ }
+
+ saveOrder(order: ProductOrders) {
+ return this.http.post(this.ordersUrl, order);
+ }
+
+ set SelectedProductOrder(value: ProductOrder) {
+ this.productOrder = value;
+ this.productOrderSubject.next();
+ }
+
+ get SelectedProductOrder() {
+ return this.productOrder;
+ }
+
+ set ProductOrders(value: ProductOrders) {
+ this.orders = value;
+ this.ordersSubject.next();
+ }
+
+ get ProductOrders() {
+ return this.orders;
+ }
+
+ get Total() {
+ return this.total;
+ }
+
+ set Total(value: number) {
+ this.total = value;
+ this.totalSubject.next();
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.css
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.html
new file mode 100644
index 0000000000..b18a02b93c
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.html
@@ -0,0 +1,18 @@
+
+
+
+
Total: ${{total}}
+
+
Items bought:
+
+
+ -
+ {{ order.product.name }} - {{ order.quantity}} pcs.
+
+
+
+
+
+
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.spec.ts
new file mode 100644
index 0000000000..5d7735477c
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ShoppingCartComponent } from './shopping-cart.component';
+
+describe('ShoppingCartComponent', () => {
+ let component: ShoppingCartComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ShoppingCartComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ShoppingCartComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.ts
new file mode 100644
index 0000000000..81a6514eb7
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.ts
@@ -0,0 +1,76 @@
+import {Component, EventEmitter, OnDestroy, OnInit, Output} from '@angular/core';
+import {ProductOrders} from "../models/product-orders.model";
+import {ProductOrder} from "../models/product-order.model";
+import {EcommerceService} from "../services/EcommerceService";
+import {Subscription} from "rxjs/internal/Subscription";
+
+@Component({
+ selector: 'app-shopping-cart',
+ templateUrl: './shopping-cart.component.html',
+ styleUrls: ['./shopping-cart.component.css']
+})
+export class ShoppingCartComponent implements OnInit, OnDestroy {
+ orderFinished: boolean;
+ orders: ProductOrders;
+ total: number;
+ sub: Subscription;
+
+ @Output() onOrderFinished: EventEmitter;
+
+ constructor(private ecommerceService: EcommerceService) {
+ this.total = 0;
+ this.orderFinished = false;
+ this.onOrderFinished = new EventEmitter();
+ }
+
+ ngOnInit() {
+ this.orders = new ProductOrders();
+ this.loadCart();
+ this.loadTotal();
+ }
+
+ private calculateTotal(products: ProductOrder[]): number {
+ let sum = 0;
+ products.forEach(value => {
+ sum += (value.product.price * value.quantity);
+ });
+ return sum;
+ }
+
+ ngOnDestroy() {
+ this.sub.unsubscribe();
+ }
+
+ finishOrder() {
+ this.orderFinished = true;
+ this.ecommerceService.Total = this.total;
+ this.onOrderFinished.emit(this.orderFinished);
+ }
+
+ loadTotal() {
+ this.sub = this.ecommerceService.OrdersChanged.subscribe(() => {
+ this.total = this.calculateTotal(this.orders.productOrders);
+ });
+ }
+
+ loadCart() {
+ this.sub = this.ecommerceService.ProductOrderChanged.subscribe(() => {
+ let productOrder = this.ecommerceService.SelectedProductOrder;
+ if (productOrder) {
+ this.orders.productOrders.push(new ProductOrder(
+ productOrder.product, productOrder.quantity));
+ }
+ this.ecommerceService.ProductOrders = this.orders;
+ this.orders = this.ecommerceService.ProductOrders;
+ this.total = this.calculateTotal(this.orders.productOrders);
+ });
+ }
+
+ reset() {
+ this.orderFinished = false;
+ this.orders = new ProductOrders();
+ this.orders.productOrders = []
+ this.loadTotal();
+ this.total = 0;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/assets/.gitkeep b/spring-boot-angular-ecommerce/src/main/frontend/src/assets/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/browserslist b/spring-boot-angular-ecommerce/src/main/frontend/src/browserslist
new file mode 100644
index 0000000000..8e09ab492e
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/browserslist
@@ -0,0 +1,9 @@
+# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
+# For additional information regarding the format and rule options, please see:
+# https://github.com/browserslist/browserslist#queries
+# For IE 9-11 support, please uncomment the last line of the file and adjust as needed
+> 0.5%
+last 2 versions
+Firefox ESR
+not dead
+# IE 9-11
\ No newline at end of file
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.prod.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.prod.ts
new file mode 100644
index 0000000000..3612073bc3
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.prod.ts
@@ -0,0 +1,3 @@
+export const environment = {
+ production: true
+};
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.ts
new file mode 100644
index 0000000000..012182efa3
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.ts
@@ -0,0 +1,15 @@
+// This file can be replaced during build by using the `fileReplacements` array.
+// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
+// The list of file replacements can be found in `angular.json`.
+
+export const environment = {
+ production: false
+};
+
+/*
+ * In development mode, to ignore zone related error stack frames such as
+ * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
+ * import the following file, but please comment it out in production mode
+ * because it will have performance impact when throw error
+ */
+// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/favicon.ico b/spring-boot-angular-ecommerce/src/main/frontend/src/favicon.ico
new file mode 100644
index 0000000000..8081c7ceaf
Binary files /dev/null and b/spring-boot-angular-ecommerce/src/main/frontend/src/favicon.ico differ
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/index.html b/spring-boot-angular-ecommerce/src/main/frontend/src/index.html
new file mode 100644
index 0000000000..3faefb6e8c
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+ Frontend
+
+
+
+
+
+
+
+
+
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/karma.conf.js b/spring-boot-angular-ecommerce/src/main/frontend/src/karma.conf.js
new file mode 100644
index 0000000000..b6e00421c9
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/karma.conf.js
@@ -0,0 +1,31 @@
+// Karma configuration file, see link for more information
+// https://karma-runner.github.io/1.0/config/configuration-file.html
+
+module.exports = function (config) {
+ config.set({
+ basePath: '',
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
+ plugins: [
+ require('karma-jasmine'),
+ require('karma-chrome-launcher'),
+ require('karma-jasmine-html-reporter'),
+ require('karma-coverage-istanbul-reporter'),
+ require('@angular-devkit/build-angular/plugins/karma')
+ ],
+ client: {
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
+ },
+ coverageIstanbulReporter: {
+ dir: require('path').join(__dirname, '../coverage'),
+ reports: ['html', 'lcovonly'],
+ fixWebpackSourcePaths: true
+ },
+ reporters: ['progress', 'kjhtml'],
+ port: 9876,
+ colors: true,
+ logLevel: config.LOG_INFO,
+ autoWatch: true,
+ browsers: ['Chrome'],
+ singleRun: false
+ });
+};
\ No newline at end of file
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/main.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/main.ts
new file mode 100644
index 0000000000..91ec6da5f0
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/main.ts
@@ -0,0 +1,12 @@
+import { enableProdMode } from '@angular/core';
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+
+import { AppModule } from './app/app.module';
+import { environment } from './environments/environment';
+
+if (environment.production) {
+ enableProdMode();
+}
+
+platformBrowserDynamic().bootstrapModule(AppModule)
+ .catch(err => console.log(err));
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/polyfills.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/polyfills.ts
new file mode 100644
index 0000000000..d310405a68
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/polyfills.ts
@@ -0,0 +1,80 @@
+/**
+ * This file includes polyfills needed by Angular and is loaded before the app.
+ * You can add your own extra polyfills to this file.
+ *
+ * This file is divided into 2 sections:
+ * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
+ * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
+ * file.
+ *
+ * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
+ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
+ * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
+ *
+ * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
+ */
+
+/***************************************************************************************************
+ * BROWSER POLYFILLS
+ */
+
+/** IE9, IE10 and IE11 requires all of the following polyfills. **/
+// import 'core-js/es6/symbol';
+// import 'core-js/es6/object';
+// import 'core-js/es6/function';
+// import 'core-js/es6/parse-int';
+// import 'core-js/es6/parse-float';
+// import 'core-js/es6/number';
+// import 'core-js/es6/math';
+// import 'core-js/es6/string';
+// import 'core-js/es6/date';
+// import 'core-js/es6/array';
+// import 'core-js/es6/regexp';
+// import 'core-js/es6/map';
+// import 'core-js/es6/weak-map';
+// import 'core-js/es6/set';
+
+/** IE10 and IE11 requires the following for NgClass support on SVG elements */
+// import 'classlist.js'; // Run `npm install --save classlist.js`.
+
+/** IE10 and IE11 requires the following for the Reflect API. */
+// import 'core-js/es6/reflect';
+
+
+/** Evergreen browsers require these. **/
+// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
+import 'core-js/es7/reflect';
+
+
+/**
+ * Web Animations `@angular/platform-browser/animations`
+ * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
+ * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
+ **/
+// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
+
+/**
+ * By default, zone.js will patch all possible macroTask and DomEvents
+ * user can disable parts of macroTask/DomEvents patch by setting following flags
+ */
+
+ // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
+ // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
+ // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
+
+ /*
+ * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
+ * with the following flag, it will bypass `zone.js` patch for IE/Edge
+ */
+// (window as any).__Zone_enable_cross_context_check = true;
+
+/***************************************************************************************************
+ * Zone JS is required by default for Angular itself.
+ */
+import 'zone.js/dist/zone'; // Included with Angular CLI.
+
+
+
+/***************************************************************************************************
+ * APPLICATION IMPORTS
+ */
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/styles.css b/spring-boot-angular-ecommerce/src/main/frontend/src/styles.css
new file mode 100644
index 0000000000..90d4ee0072
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/styles.css
@@ -0,0 +1 @@
+/* You can add global styles to this file, and also import other style files */
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/test.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/test.ts
new file mode 100644
index 0000000000..16317897b1
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/test.ts
@@ -0,0 +1,20 @@
+// This file is required by karma.conf.js and loads recursively all the .spec and framework files
+
+import 'zone.js/dist/zone-testing';
+import { getTestBed } from '@angular/core/testing';
+import {
+ BrowserDynamicTestingModule,
+ platformBrowserDynamicTesting
+} from '@angular/platform-browser-dynamic/testing';
+
+declare const require: any;
+
+// First, initialize the Angular testing environment.
+getTestBed().initTestEnvironment(
+ BrowserDynamicTestingModule,
+ platformBrowserDynamicTesting()
+);
+// Then we find all the tests.
+const context = require.context('./', true, /\.spec\.ts$/);
+// And load the modules.
+context.keys().map(context);
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.app.json b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.app.json
new file mode 100644
index 0000000000..722c370d58
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.app.json
@@ -0,0 +1,12 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../out-tsc/app",
+ "module": "es2015",
+ "types": []
+ },
+ "exclude": [
+ "src/test.ts",
+ "**/*.spec.ts"
+ ]
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.spec.json b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.spec.json
new file mode 100644
index 0000000000..8f7cedecab
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.spec.json
@@ -0,0 +1,19 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../out-tsc/spec",
+ "module": "commonjs",
+ "types": [
+ "jasmine",
+ "node"
+ ]
+ },
+ "files": [
+ "test.ts",
+ "polyfills.ts"
+ ],
+ "include": [
+ "**/*.spec.ts",
+ "**/*.d.ts"
+ ]
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/tslint.json b/spring-boot-angular-ecommerce/src/main/frontend/src/tslint.json
new file mode 100644
index 0000000000..52e2c1a5a7
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/src/tslint.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../tslint.json",
+ "rules": {
+ "directive-selector": [
+ true,
+ "attribute",
+ "app",
+ "camelCase"
+ ],
+ "component-selector": [
+ true,
+ "element",
+ "app",
+ "kebab-case"
+ ]
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/tsconfig.json b/spring-boot-angular-ecommerce/src/main/frontend/tsconfig.json
new file mode 100644
index 0000000000..ef44e2862b
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compileOnSave": false,
+ "compilerOptions": {
+ "baseUrl": "./",
+ "outDir": "./dist/out-tsc",
+ "sourceMap": true,
+ "declaration": false,
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "target": "es5",
+ "typeRoots": [
+ "node_modules/@types"
+ ],
+ "lib": [
+ "es2017",
+ "dom"
+ ]
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/tslint.json b/spring-boot-angular-ecommerce/src/main/frontend/tslint.json
new file mode 100644
index 0000000000..3ea984c776
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/frontend/tslint.json
@@ -0,0 +1,130 @@
+{
+ "rulesDirectory": [
+ "node_modules/codelyzer"
+ ],
+ "rules": {
+ "arrow-return-shorthand": true,
+ "callable-types": true,
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "curly": true,
+ "deprecation": {
+ "severity": "warn"
+ },
+ "eofline": true,
+ "forin": true,
+ "import-blacklist": [
+ true,
+ "rxjs/Rx"
+ ],
+ "import-spacing": true,
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "interface-over-type-literal": true,
+ "label-position": true,
+ "max-line-length": [
+ true,
+ 140
+ ],
+ "member-access": false,
+ "member-ordering": [
+ true,
+ {
+ "order": [
+ "static-field",
+ "instance-field",
+ "static-method",
+ "instance-method"
+ ]
+ }
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [
+ true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-super": true,
+ "no-empty": false,
+ "no-empty-interface": true,
+ "no-eval": true,
+ "no-inferrable-types": [
+ true,
+ "ignore-params"
+ ],
+ "no-misused-new": true,
+ "no-non-null-assertion": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": false,
+ "no-string-throw": true,
+ "no-switch-case-fall-through": true,
+ "no-trailing-whitespace": true,
+ "no-unnecessary-initializer": true,
+ "no-unused-expression": true,
+ "no-use-before-declare": true,
+ "no-var-keyword": true,
+ "object-literal-sort-keys": false,
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "prefer-const": true,
+ "quotemark": [
+ true,
+ "single"
+ ],
+ "radix": true,
+ "semicolon": [
+ true,
+ "always"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ }
+ ],
+ "unified-signatures": true,
+ "variable-name": false,
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ],
+ "no-output-on-prefix": true,
+ "use-input-property-decorator": true,
+ "use-output-property-decorator": true,
+ "use-host-property-decorator": true,
+ "no-input-rename": true,
+ "no-output-rename": true,
+ "use-life-cycle-interface": true,
+ "use-pipe-transform-interface": true,
+ "component-class-suffix": true,
+ "directive-class-suffix": true
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/EcommerceApplication.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/EcommerceApplication.java
new file mode 100644
index 0000000000..b1fa14e9a9
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/EcommerceApplication.java
@@ -0,0 +1,29 @@
+package com.baeldung.ecommerce;
+
+import com.baeldung.ecommerce.model.Product;
+import com.baeldung.ecommerce.service.ProductService;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+
+@SpringBootApplication
+public class EcommerceApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(EcommerceApplication.class, args);
+ }
+
+ @Bean
+ CommandLineRunner runner(ProductService productService) {
+ return args -> {
+ productService.save(new Product(1L, "TV Set", 300.00, "http://placehold.it/200x100"));
+ productService.save(new Product(2L, "Game Console", 200.00, "http://placehold.it/200x100"));
+ productService.save(new Product(3L, "Sofa", 100.00, "http://placehold.it/200x100"));
+ productService.save(new Product(4L, "Icecream", 5.00, "http://placehold.it/200x100"));
+ productService.save(new Product(5L, "Beer", 3.00, "http://placehold.it/200x100"));
+ productService.save(new Product(6L, "Phone", 500.00, "http://placehold.it/200x100"));
+ productService.save(new Product(7L, "Watch", 30.00, "http://placehold.it/200x100"));
+ };
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/OrderController.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/OrderController.java
new file mode 100644
index 0000000000..c239496708
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/OrderController.java
@@ -0,0 +1,99 @@
+package com.baeldung.ecommerce.controller;
+
+import com.baeldung.ecommerce.dto.OrderProductDto;
+import com.baeldung.ecommerce.exception.ResourceNotFoundException;
+import com.baeldung.ecommerce.model.Order;
+import com.baeldung.ecommerce.model.OrderProduct;
+import com.baeldung.ecommerce.model.OrderStatus;
+import com.baeldung.ecommerce.service.OrderProductService;
+import com.baeldung.ecommerce.service.OrderService;
+import com.baeldung.ecommerce.service.ProductService;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import javax.validation.constraints.NotNull;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/api/orders")
+public class OrderController {
+
+ ProductService productService;
+ OrderService orderService;
+ OrderProductService orderProductService;
+
+ public OrderController(ProductService productService, OrderService orderService, OrderProductService orderProductService) {
+ this.productService = productService;
+ this.orderService = orderService;
+ this.orderProductService = orderProductService;
+ }
+
+ @GetMapping
+ @ResponseStatus(HttpStatus.OK)
+ public @NotNull Iterable list() {
+ return this.orderService.getAllOrders();
+ }
+
+ @PostMapping
+ public ResponseEntity create(@RequestBody OrderForm form) {
+ List formDtos = form.getProductOrders();
+ validateProductsExistence(formDtos);
+ Order order = new Order();
+ order.setStatus(OrderStatus.PAID.name());
+ order = this.orderService.create(order);
+
+ List orderProducts = new ArrayList<>();
+ for (OrderProductDto dto : formDtos) {
+ orderProducts.add(orderProductService.create(new OrderProduct(order, productService.getProduct(dto
+ .getProduct()
+ .getId()), dto.getQuantity())));
+ }
+
+ order.setOrderProducts(orderProducts);
+
+ this.orderService.update(order);
+
+ String uri = ServletUriComponentsBuilder
+ .fromCurrentServletMapping()
+ .path("/orders/{id}")
+ .buildAndExpand(order.getId())
+ .toString();
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Location", uri);
+
+ return new ResponseEntity<>(order, headers, HttpStatus.CREATED);
+ }
+
+ private void validateProductsExistence(List orderProducts) {
+ List list = orderProducts
+ .stream()
+ .filter(op -> Objects.isNull(productService.getProduct(op
+ .getProduct()
+ .getId())))
+ .collect(Collectors.toList());
+
+ if (!CollectionUtils.isEmpty(list)) {
+ new ResourceNotFoundException("Product not found");
+ }
+ }
+
+ public static class OrderForm {
+
+ private List productOrders;
+
+ public List getProductOrders() {
+ return productOrders;
+ }
+
+ public void setProductOrders(List productOrders) {
+ this.productOrders = productOrders;
+ }
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/ProductController.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/ProductController.java
new file mode 100644
index 0000000000..0f5af0af4b
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/ProductController.java
@@ -0,0 +1,25 @@
+package com.baeldung.ecommerce.controller;
+
+import com.baeldung.ecommerce.model.Product;
+import com.baeldung.ecommerce.service.ProductService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.constraints.NotNull;
+
+@RestController
+@RequestMapping("/api/products")
+public class ProductController {
+
+ private ProductService productService;
+
+ public ProductController(ProductService productService) {
+ this.productService = productService;
+ }
+
+ @GetMapping(value = { "", "/" })
+ public @NotNull Iterable getProducts() {
+ return productService.getAllProducts();
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/dto/OrderProductDto.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/dto/OrderProductDto.java
new file mode 100644
index 0000000000..f4c92ee28e
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/dto/OrderProductDto.java
@@ -0,0 +1,25 @@
+package com.baeldung.ecommerce.dto;
+
+import com.baeldung.ecommerce.model.Product;
+
+public class OrderProductDto {
+
+ private Product product;
+ private Integer quantity;
+
+ public Product getProduct() {
+ return product;
+ }
+
+ public void setProduct(Product product) {
+ this.product = product;
+ }
+
+ public Integer getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Integer quantity) {
+ this.quantity = quantity;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ApiExceptionHandler.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ApiExceptionHandler.java
new file mode 100644
index 0000000000..aae7e39ffc
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ApiExceptionHandler.java
@@ -0,0 +1,81 @@
+package com.baeldung.ecommerce.exception;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import java.util.ArrayList;
+import java.util.List;
+
+@RestControllerAdvice
+public class ApiExceptionHandler {
+
+ @SuppressWarnings("rawtypes")
+ @ExceptionHandler(ConstraintViolationException.class)
+ public ResponseEntity handle(ConstraintViolationException e) {
+ ErrorResponse errors = new ErrorResponse();
+ for (ConstraintViolation violation : e.getConstraintViolations()) {
+ ErrorItem error = new ErrorItem();
+ error.setCode(violation.getMessageTemplate());
+ error.setMessage(violation.getMessage());
+ errors.addError(error);
+ }
+
+ return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @ExceptionHandler(ResourceNotFoundException.class)
+ public ResponseEntity handle(ResourceNotFoundException e) {
+ ErrorItem error = new ErrorItem();
+ error.setMessage(e.getMessage());
+
+ return new ResponseEntity<>(error, HttpStatus.NOT_FOUND);
+ }
+
+ public static class ErrorItem {
+
+ @JsonInclude(JsonInclude.Include.NON_NULL) private String code;
+
+ private String message;
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ }
+
+ public static class ErrorResponse {
+
+ private List errors = new ArrayList<>();
+
+ public List getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List errors) {
+ this.errors = errors;
+ }
+
+ public void addError(ErrorItem error) {
+ this.errors.add(error);
+ }
+
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ResourceNotFoundException.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ResourceNotFoundException.java
new file mode 100644
index 0000000000..3d8e47326c
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ResourceNotFoundException.java
@@ -0,0 +1,22 @@
+package com.baeldung.ecommerce.exception;
+
+public class ResourceNotFoundException extends RuntimeException {
+
+ private static final long serialVersionUID = 5861310537366287163L;
+
+ public ResourceNotFoundException() {
+ super();
+ }
+
+ public ResourceNotFoundException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public ResourceNotFoundException(final String message) {
+ super(message);
+ }
+
+ public ResourceNotFoundException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Order.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Order.java
new file mode 100644
index 0000000000..5b91bc0956
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Order.java
@@ -0,0 +1,78 @@
+package com.baeldung.ecommerce.model;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.JsonManagedReference;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+import javax.persistence.*;
+import javax.validation.Valid;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+
+@Entity
+@Table(name = "orders")
+@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="orderProducts")
+public class Order {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
+
+ @JsonFormat(pattern = "dd/MM/yyyy") private LocalDate dateCreated;
+
+ private String status;
+
+ @OneToMany(mappedBy = "pk.order")
+ @Valid
+ private List orderProducts = new ArrayList<>();
+
+ @Transient
+ public Double getTotalOrderPrice() {
+ double sum = 0D;
+ List orderProducts = getOrderProducts();
+ for (OrderProduct op : orderProducts) {
+ sum += op.getTotalPrice();
+ }
+
+ return sum;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public LocalDate getDateCreated() {
+ return dateCreated;
+ }
+
+ public void setDateCreated(LocalDate dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public List getOrderProducts() {
+ return orderProducts;
+ }
+
+ public void setOrderProducts(List orderProducts) {
+ this.orderProducts = orderProducts;
+ }
+
+ @Transient
+ public int getNumberOfProducts() {
+ return this.orderProducts.size();
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProduct.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProduct.java
new file mode 100644
index 0000000000..eb1b9876c3
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProduct.java
@@ -0,0 +1,87 @@
+package com.baeldung.ecommerce.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import javax.persistence.Column;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Transient;
+
+@Entity
+public class OrderProduct {
+
+ @EmbeddedId
+ @JsonIgnore
+ private OrderProductPK pk;
+
+ @Column(nullable = false) private Integer quantity;
+
+ public OrderProduct() {
+ super();
+ }
+
+ public OrderProduct(Order order, Product product, Integer quantity) {
+ pk = new OrderProductPK();
+ pk.setOrder(order);
+ pk.setProduct(product);
+ this.quantity = quantity;
+ }
+
+ @Transient
+ public Product getProduct() {
+ return this.pk.getProduct();
+ }
+
+ @Transient
+ public Double getTotalPrice() {
+ return getProduct().getPrice() * getQuantity();
+ }
+
+ public OrderProductPK getPk() {
+ return pk;
+ }
+
+ public void setPk(OrderProductPK pk) {
+ this.pk = pk;
+ }
+
+ public Integer getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(Integer quantity) {
+ this.quantity = quantity;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((pk == null) ? 0 : pk.hashCode());
+
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderProduct other = (OrderProduct) obj;
+ if (pk == null) {
+ if (other.pk != null) {
+ return false;
+ }
+ } else if (!pk.equals(other.pk)) {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProductPK.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProductPK.java
new file mode 100644
index 0000000000..8440a363c1
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProductPK.java
@@ -0,0 +1,91 @@
+package com.baeldung.ecommerce.model;
+
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+import javax.persistence.Embeddable;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import java.io.Serializable;
+
+@Embeddable
+@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "order")
+public class OrderProductPK implements Serializable {
+
+ private static final long serialVersionUID = 476151177562655457L;
+
+ @ManyToOne(optional = false, fetch = FetchType.LAZY)
+ @JoinColumn(name = "order_id")
+ private Order order;
+
+ @ManyToOne(optional = false, fetch = FetchType.LAZY)
+ @JoinColumn(name = "product_id")
+ private Product product;
+
+ public Order getOrder() {
+ return order;
+ }
+
+ public void setOrder(Order order) {
+ this.order = order;
+ }
+
+ public Product getProduct() {
+ return product;
+ }
+
+ public void setProduct(Product product) {
+ this.product = product;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+
+ result = prime * result + ((order.getId() == null)
+ ? 0
+ : order
+ .getId()
+ .hashCode());
+ result = prime * result + ((product.getId() == null)
+ ? 0
+ : product
+ .getId()
+ .hashCode());
+
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ OrderProductPK other = (OrderProductPK) obj;
+ if (order == null) {
+ if (other.order != null) {
+ return false;
+ }
+ } else if (!order.equals(other.order)) {
+ return false;
+ }
+
+ if (product == null) {
+ if (other.product != null) {
+ return false;
+ }
+ } else if (!product.equals(other.product)) {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderStatus.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderStatus.java
new file mode 100644
index 0000000000..36bcd5e30d
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderStatus.java
@@ -0,0 +1,5 @@
+package com.baeldung.ecommerce.model;
+
+public enum OrderStatus {
+ PAID
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Product.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Product.java
new file mode 100644
index 0000000000..fe2061fab5
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Product.java
@@ -0,0 +1,62 @@
+package com.baeldung.ecommerce.model;
+
+import javax.persistence.*;
+import javax.validation.constraints.NotNull;
+
+@Entity
+public class Product {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
+
+ @NotNull(message = "Product name is required.")
+ @Basic(optional = false)
+ private String name;
+
+ private Double price;
+
+ private String pictureUrl;
+
+ public Product(Long id, @NotNull(message = "Product name is required.") String name, Double price, String pictureUrl) {
+ this.id = id;
+ this.name = name;
+ this.price = price;
+ this.pictureUrl = pictureUrl;
+ }
+
+ public Product() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Double getPrice() {
+ return price;
+ }
+
+ public void setPrice(Double price) {
+ this.price = price;
+ }
+
+ public String getPictureUrl() {
+ return pictureUrl;
+ }
+
+ public void setPictureUrl(String pictureUrl) {
+ this.pictureUrl = pictureUrl;
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderProductRepository.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderProductRepository.java
new file mode 100644
index 0000000000..f596ef8520
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderProductRepository.java
@@ -0,0 +1,8 @@
+package com.baeldung.ecommerce.repository;
+
+import com.baeldung.ecommerce.model.OrderProduct;
+import com.baeldung.ecommerce.model.OrderProductPK;
+import org.springframework.data.repository.CrudRepository;
+
+public interface OrderProductRepository extends CrudRepository {
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderRepository.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderRepository.java
new file mode 100644
index 0000000000..c6ed21707a
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderRepository.java
@@ -0,0 +1,7 @@
+package com.baeldung.ecommerce.repository;
+
+import com.baeldung.ecommerce.model.Order;
+import org.springframework.data.repository.CrudRepository;
+
+public interface OrderRepository extends CrudRepository {
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/ProductRepository.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/ProductRepository.java
new file mode 100644
index 0000000000..ff56b54527
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/ProductRepository.java
@@ -0,0 +1,7 @@
+package com.baeldung.ecommerce.repository;
+
+import com.baeldung.ecommerce.model.Product;
+import org.springframework.data.repository.CrudRepository;
+
+public interface ProductRepository extends CrudRepository {
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductService.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductService.java
new file mode 100644
index 0000000000..575cd68e88
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductService.java
@@ -0,0 +1,13 @@
+package com.baeldung.ecommerce.service;
+
+import com.baeldung.ecommerce.model.OrderProduct;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+
+@Validated
+public interface OrderProductService {
+
+ OrderProduct create(@NotNull(message = "The products for order cannot be null.") @Valid OrderProduct orderProduct);
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductServiceImpl.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductServiceImpl.java
new file mode 100644
index 0000000000..239201d929
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductServiceImpl.java
@@ -0,0 +1,22 @@
+package com.baeldung.ecommerce.service;
+
+import com.baeldung.ecommerce.model.OrderProduct;
+import com.baeldung.ecommerce.repository.OrderProductRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class OrderProductServiceImpl implements OrderProductService {
+
+ private OrderProductRepository orderProductRepository;
+
+ public OrderProductServiceImpl(OrderProductRepository orderProductRepository) {
+ this.orderProductRepository = orderProductRepository;
+ }
+
+ @Override
+ public OrderProduct create(OrderProduct orderProduct) {
+ return this.orderProductRepository.save(orderProduct);
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderService.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderService.java
new file mode 100644
index 0000000000..babc5f88c6
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderService.java
@@ -0,0 +1,17 @@
+package com.baeldung.ecommerce.service;
+
+import com.baeldung.ecommerce.model.Order;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+
+@Validated
+public interface OrderService {
+
+ @NotNull Iterable getAllOrders();
+
+ Order create(@NotNull(message = "The order cannot be null.") @Valid Order order);
+
+ void update(@NotNull(message = "The order cannot be null.") @Valid Order order);
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderServiceImpl.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderServiceImpl.java
new file mode 100644
index 0000000000..2833cfcfb6
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderServiceImpl.java
@@ -0,0 +1,36 @@
+package com.baeldung.ecommerce.service;
+
+import com.baeldung.ecommerce.model.Order;
+import com.baeldung.ecommerce.repository.OrderRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDate;
+
+@Service
+@Transactional
+public class OrderServiceImpl implements OrderService {
+
+ private OrderRepository orderRepository;
+
+ public OrderServiceImpl(OrderRepository orderRepository) {
+ this.orderRepository = orderRepository;
+ }
+
+ @Override
+ public Iterable getAllOrders() {
+ return this.orderRepository.findAll();
+ }
+
+ @Override
+ public Order create(Order order) {
+ order.setDateCreated(LocalDate.now());
+
+ return this.orderRepository.save(order);
+ }
+
+ @Override
+ public void update(Order order) {
+ this.orderRepository.save(order);
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductService.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductService.java
new file mode 100644
index 0000000000..0887f326cb
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductService.java
@@ -0,0 +1,17 @@
+package com.baeldung.ecommerce.service;
+
+import com.baeldung.ecommerce.model.Product;
+import org.springframework.validation.annotation.Validated;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+
+@Validated
+public interface ProductService {
+
+ @NotNull Iterable getAllProducts();
+
+ Product getProduct(@Min(value = 1L, message = "Invalid product ID.") long id);
+
+ Product save(Product product);
+}
diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductServiceImpl.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductServiceImpl.java
new file mode 100644
index 0000000000..af0cc1aaa8
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductServiceImpl.java
@@ -0,0 +1,35 @@
+package com.baeldung.ecommerce.service;
+
+import com.baeldung.ecommerce.exception.ResourceNotFoundException;
+import com.baeldung.ecommerce.model.Product;
+import com.baeldung.ecommerce.repository.ProductRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@Transactional
+public class ProductServiceImpl implements ProductService {
+
+ private ProductRepository productRepository;
+
+ public ProductServiceImpl(ProductRepository productRepository) {
+ this.productRepository = productRepository;
+ }
+
+ @Override
+ public Iterable getAllProducts() {
+ return productRepository.findAll();
+ }
+
+ @Override
+ public Product getProduct(long id) {
+ return productRepository
+ .findById(id)
+ .orElseThrow(() -> new ResourceNotFoundException("Product not found"));
+ }
+
+ @Override
+ public Product save(Product product) {
+ return productRepository.save(product);
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/main/resources/application.properties b/spring-boot-angular-ecommerce/src/main/resources/application.properties
new file mode 100644
index 0000000000..63a81576af
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/resources/application.properties
@@ -0,0 +1,8 @@
+management.security.enabled=false
+
+spring.datasource.name=ecommercedb
+spring.jpa.show-sql=false
+
+#H2 settings
+spring.h2.console.enabled=true
+spring.h2.console.path=/h2-console
diff --git a/spring-boot-angular-ecommerce/src/main/resources/logback.xml b/spring-boot-angular-ecommerce/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-angular-ecommerce/src/test/java/com/baeldung/ecommerce/EcommerceApplicationIntegrationTest.java b/spring-boot-angular-ecommerce/src/test/java/com/baeldung/ecommerce/EcommerceApplicationIntegrationTest.java
new file mode 100644
index 0000000000..03450ea7b2
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/test/java/com/baeldung/ecommerce/EcommerceApplicationIntegrationTest.java
@@ -0,0 +1,100 @@
+package com.baeldung.ecommerce;
+
+import com.baeldung.ecommerce.controller.OrderController;
+import com.baeldung.ecommerce.controller.ProductController;
+import com.baeldung.ecommerce.dto.OrderProductDto;
+import com.baeldung.ecommerce.model.Order;
+import com.baeldung.ecommerce.model.Product;
+import org.assertj.core.api.Assertions;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.hasProperty;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = { EcommerceApplication.class }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class EcommerceApplicationIntegrationTest {
+
+ @Autowired private TestRestTemplate restTemplate;
+
+ @LocalServerPort private int port;
+
+ @Autowired private ProductController productController;
+
+ @Autowired private OrderController orderController;
+
+ @Test
+ public void contextLoads() {
+ Assertions
+ .assertThat(productController)
+ .isNotNull();
+ Assertions
+ .assertThat(orderController)
+ .isNotNull();
+ }
+
+ @Test
+ public void givenGetProductsApiCall_whenProductListRetrieved_thenSizeMatchAndListContainsProductNames() {
+ ResponseEntity> responseEntity = restTemplate.exchange("http://localhost:" + port + "/api/products", HttpMethod.GET, null, new ParameterizedTypeReference>() {
+ });
+ Iterable products = responseEntity.getBody();
+ Assertions
+ .assertThat(products)
+ .hasSize(7);
+
+ assertThat(products, hasItem(hasProperty("name", is("TV Set"))));
+ assertThat(products, hasItem(hasProperty("name", is("Game Console"))));
+ assertThat(products, hasItem(hasProperty("name", is("Sofa"))));
+ assertThat(products, hasItem(hasProperty("name", is("Icecream"))));
+ assertThat(products, hasItem(hasProperty("name", is("Beer"))));
+ assertThat(products, hasItem(hasProperty("name", is("Phone"))));
+ assertThat(products, hasItem(hasProperty("name", is("Watch"))));
+ }
+
+ @Test
+ public void givenGetOrdersApiCall_whenProductListRetrieved_thenSizeMatchAndListContainsProductNames() {
+ ResponseEntity> responseEntity = restTemplate.exchange("http://localhost:" + port + "/api/orders", HttpMethod.GET, null, new ParameterizedTypeReference>() {
+ });
+
+ Iterable orders = responseEntity.getBody();
+ Assertions
+ .assertThat(orders)
+ .hasSize(0);
+ }
+
+ @Test
+ public void givenPostOrder_whenBodyRequestMatcherJson_thenResponseContainsEqualObjectProperties() {
+ final ResponseEntity postResponse = restTemplate.postForEntity("http://localhost:" + port + "/api/orders", prepareOrderForm(), Order.class);
+ Order order = postResponse.getBody();
+ Assertions
+ .assertThat(postResponse.getStatusCode())
+ .isEqualByComparingTo(HttpStatus.CREATED);
+
+ assertThat(order, hasProperty("status", is("PAID")));
+ assertThat(order.getOrderProducts(), hasItem(hasProperty("quantity", is(2))));
+ }
+
+ private OrderController.OrderForm prepareOrderForm() {
+ OrderController.OrderForm orderForm = new OrderController.OrderForm();
+ OrderProductDto productDto = new OrderProductDto();
+ productDto.setProduct(new Product(1L, "TV Set", 300.00, "http://placehold.it/200x100"));
+ productDto.setQuantity(2);
+ orderForm.setProductOrders(Collections.singletonList(productDto));
+
+ return orderForm;
+ }
+}
diff --git a/spring-boot-autoconfiguration/src/main/resources/logback.xml b/spring-boot-autoconfiguration/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-autoconfiguration/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-bootstrap/src/main/resources/logback.xml b/spring-boot-bootstrap/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-bootstrap/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-ctx-fluent/src/main/resources/logback.xml b/spring-boot-ctx-fluent/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-ctx-fluent/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-custom-starter/greeter-library/src/main/resources/logback.xml b/spring-boot-custom-starter/greeter-library/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-custom-starter/greeter-library/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/main/resources/logback.xml b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/main/resources/logback.xml b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-gradle/src/main/resources/logback.xml b/spring-boot-gradle/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-gradle/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-jasypt/pom.xml b/spring-boot-jasypt/pom.xml
index 7767130a43..8b7a475824 100644
--- a/spring-boot-jasypt/pom.xml
+++ b/spring-boot-jasypt/pom.xml
@@ -12,10 +12,10 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.1.RELEASE
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
diff --git a/spring-boot-jasypt/src/main/resources/logback.xml b/spring-boot-jasypt/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-jasypt/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-keycloak/src/main/resources/logback.xml b/spring-boot-keycloak/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-keycloak/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-logging-log4j2/pom.xml b/spring-boot-logging-log4j2/pom.xml
index 3417043e91..61f949b820 100644
--- a/spring-boot-logging-log4j2/pom.xml
+++ b/spring-boot-logging-log4j2/pom.xml
@@ -10,10 +10,10 @@
Demo project for Spring Boot Logging with Log4J2
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.3.RELEASE
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml
index f4a1d75673..d0fce26bb5 100644
--- a/spring-boot-mvc/pom.xml
+++ b/spring-boot-mvc/pom.xml
@@ -10,11 +10,11 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
+
@@ -27,6 +27,11 @@
spring-boot-starter-test
test
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/LoginController.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/LoginController.java
new file mode 100644
index 0000000000..589024c0bc
--- /dev/null
+++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/LoginController.java
@@ -0,0 +1,20 @@
+package com.baeldung.springbootmvc;
+
+import javax.validation.Valid;
+
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.baeldung.springbootmvc.model.LoginForm;
+
+@RestController
+@RequestMapping("/")
+public class LoginController {
+
+ @PostMapping("loginform")
+ public String processLogin(@Valid LoginForm form) {
+ return "Success";
+
+ }
+}
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java
index c4213af0a3..df8f72f500 100644
--- a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java
+++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java
@@ -2,12 +2,11 @@ package com.baeldung.springbootmvc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@SpringBootApplication
public class SpringBootMvcApplication {
- public static void main(String[] args) {
- SpringApplication.run(SpringBootMvcApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootMvcApplication.class, args);
+ }
}
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/CustomMessageSourceConfiguration.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/CustomMessageSourceConfiguration.java
new file mode 100644
index 0000000000..e83f15a366
--- /dev/null
+++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/CustomMessageSourceConfiguration.java
@@ -0,0 +1,27 @@
+package com.baeldung.springbootmvc.config;
+
+import org.springframework.context.MessageSource;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.ReloadableResourceBundleMessageSource;
+import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
+
+@Configuration
+public class CustomMessageSourceConfiguration {
+
+ @Bean
+ public MessageSource messageSource() {
+ ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
+ messageSource.setBasename("classpath:messages");
+ messageSource.setDefaultEncoding("UTF-8");
+ return messageSource;
+ }
+
+ @Bean
+ public LocalValidatorFactoryBean getValidator() {
+ LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
+ bean.setValidationMessageSource(messageSource());
+ return bean;
+ }
+
+}
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java
index 1ee13ccec2..9a1f47b5cb 100644
--- a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java
+++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java
@@ -32,12 +32,13 @@ public class FaviconConfiguration {
requestHandler.setLocations(locations);
return requestHandler;
}
-
- //@Controller
+
+ // @Controller
static class FaviconController {
-
- @RequestMapping(value="favicon.ico", method=RequestMethod.GET)
+
+ @RequestMapping(value = "favicon.ico", method = RequestMethod.GET)
@ResponseBody
- void favicon() {}
+ void favicon() {
+ }
}
}
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/model/LoginForm.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/model/LoginForm.java
new file mode 100644
index 0000000000..107cd1bbf1
--- /dev/null
+++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/model/LoginForm.java
@@ -0,0 +1,32 @@
+package com.baeldung.springbootmvc.model;
+
+import javax.validation.constraints.Email;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+public class LoginForm {
+
+ @NotEmpty(message = "{email.notempty}")
+ @Email
+ private String email;
+
+ @NotNull
+ private String password;
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+}
diff --git a/spring-boot-mvc/src/main/resources/logback.xml b/spring-boot-mvc/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-mvc/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-mvc/src/main/resources/messages.properties b/spring-boot-mvc/src/main/resources/messages.properties
new file mode 100644
index 0000000000..9794c89651
--- /dev/null
+++ b/spring-boot-mvc/src/main/resources/messages.properties
@@ -0,0 +1 @@
+email.notempty=Please provide valid email id.
\ No newline at end of file
diff --git a/spring-boot-mvc/src/main/resources/messages_fr.properties b/spring-boot-mvc/src/main/resources/messages_fr.properties
new file mode 100644
index 0000000000..070f4e0bfc
--- /dev/null
+++ b/spring-boot-mvc/src/main/resources/messages_fr.properties
@@ -0,0 +1 @@
+email.notempty=Veuillez fournir un identifiant de messagerie valide.
\ No newline at end of file
diff --git a/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/LoginControllerUnitTest.java b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/LoginControllerUnitTest.java
new file mode 100644
index 0000000000..68229f459c
--- /dev/null
+++ b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/LoginControllerUnitTest.java
@@ -0,0 +1,35 @@
+package com.baeldung.springbootmvc;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.RequestBuilder;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+import com.baeldung.springbootmvc.config.CustomMessageSourceConfiguration;
+
+@RunWith(SpringRunner.class)
+@WebMvcTest(value = LoginController.class, secure = false)
+@ContextConfiguration(classes = { SpringBootMvcApplication.class, CustomMessageSourceConfiguration.class })
+public class LoginControllerUnitTest {
+
+ @Autowired
+ private MockMvc mockMvc;
+
+ @Test
+ public void givenLoginForm_whenEmailFieldNotProvided_testCustomValidMessageIsReturned() throws Exception {
+
+ RequestBuilder builder = MockMvcRequestBuilders.post("/loginform").param("email", "").param("password", "helo");
+
+ // header("accept-language", "fr").
+ MvcResult perform = mockMvc.perform(builder).andReturn();
+ Assert.assertTrue(perform.getResolvedException().getMessage().contains("valid email"));
+
+ }
+}
\ No newline at end of file
diff --git a/spring-boot-ops/README.md b/spring-boot-ops/README.md
index 9760e73576..c125c96c36 100644
--- a/spring-boot-ops/README.md
+++ b/spring-boot-ops/README.md
@@ -8,4 +8,5 @@
- [A Quick Guide to Maven Wrapper](http://www.baeldung.com/maven-wrapper)
- [Shutdown a Spring Boot Application](http://www.baeldung.com/spring-boot-shutdown)
- [Spring Boot Console Application](http://www.baeldung.com/spring-boot-console-app)
+ - [Comparing Embedded Servlet Containers in Spring Boot](http://www.baeldung.com/spring-boot-servlet-containers)
diff --git a/spring-boot-ops/src/main/resources/logback.xml b/spring-boot-ops/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-ops/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-persistence/src/main/resources/logback.xml b/spring-boot-persistence/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-persistence/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-property-exp/property-exp-custom-config/src/main/resources/logback.xml b/spring-boot-property-exp/property-exp-custom-config/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-property-exp/property-exp-custom-config/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-property-exp/property-exp-default-config/src/main/resources/logback.xml b/spring-boot-property-exp/property-exp-default-config/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-property-exp/property-exp-default-config/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-security/src/main/resources/logback.xml b/spring-boot-security/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-security/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-vue/README.md b/spring-boot-vue/README.md
new file mode 100644
index 0000000000..e68f961e51
--- /dev/null
+++ b/spring-boot-vue/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Vue.js Frontend with a Spring Boot Backend](http://www.baeldung.com/spring-boot-vue-js)
diff --git a/spring-boot-vue/pom.xml b/spring-boot-vue/pom.xml
index 151fd293bb..d581b11d68 100644
--- a/spring-boot-vue/pom.xml
+++ b/spring-boot-vue/pom.xml
@@ -12,11 +12,11 @@
Demo project for Spring Boot Vue project
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
+
UTF-8
diff --git a/spring-boot-vue/src/main/resources/logback.xml b/spring-boot-vue/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-boot-vue/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot/README.MD b/spring-boot/README.MD
index a572a16b67..1532889a5c 100644
--- a/spring-boot/README.MD
+++ b/spring-boot/README.MD
@@ -35,3 +35,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Guide to the Favicon in Spring Boot](http://www.baeldung.com/spring-boot-favicon)
- [Spring Shutdown Callbacks](http://www.baeldung.com/spring-shutdown-callbacks)
- [Spring Boot Integration Testing with Embedded MongoDB](http://www.baeldung.com/spring-boot-embedded-mongodb)
+- [Container Configuration in Spring Boot 2](http://www.baeldung.com/embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot)
diff --git a/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java
index 69abeb0bdd..9554facb12 100644
--- a/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java
+++ b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java
@@ -1,6 +1,8 @@
package org.baeldung.boot.config;
import org.baeldung.boot.converter.StringToEmployeeConverter;
+import org.baeldung.boot.converter.StringToEnumConverterFactory;
+import org.baeldung.boot.converter.GenericBigDecimalConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -11,5 +13,8 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverter(new StringToEmployeeConverter());
+ registry.addConverterFactory(new StringToEnumConverterFactory());
+ registry.addConverter(new GenericBigDecimalConverter());
}
}
+
diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java b/spring-boot/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java
new file mode 100644
index 0000000000..8add28fc2d
--- /dev/null
+++ b/spring-boot/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java
@@ -0,0 +1,31 @@
+package org.baeldung.boot.converter;
+
+import com.google.common.collect.ImmutableSet;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.core.convert.converter.GenericConverter;
+import java.math.BigDecimal;
+import java.util.Set;
+public class GenericBigDecimalConverter implements GenericConverter {
+ @Override
+ public Set getConvertibleTypes () {
+ ConvertiblePair[] pairs = new ConvertiblePair[] {
+ new ConvertiblePair(Number.class, BigDecimal.class),
+ new ConvertiblePair(String.class, BigDecimal.class)};
+ return ImmutableSet.copyOf(pairs);
+ }
+ @Override
+ public Object convert (Object source, TypeDescriptor sourceType,
+ TypeDescriptor targetType) {
+ if (sourceType.getType() == BigDecimal.class) {
+ return source;
+ }
+ if(sourceType.getType() == String.class) {
+ String number = (String) source;
+ return new BigDecimal(number);
+ } else {
+ Number number = (Number) source;
+ BigDecimal converted = new BigDecimal(number.doubleValue());
+ return converted.setScale(2, BigDecimal.ROUND_HALF_EVEN);
+ }
+ }
+}
\ No newline at end of file
diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java
index 6902cd84d1..1bf75b38f0 100644
--- a/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java
+++ b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java
@@ -9,8 +9,6 @@ public class StringToEmployeeConverter implements Converter {
@Override
public Employee convert(String from) {
String[] data = from.split(",");
- return new Employee(
- Long.parseLong(data[0]),
- Double.parseDouble(data[1]));
+ return new Employee(Long.parseLong(data[0]), Double.parseDouble(data[1]));
}
}
diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java
new file mode 100644
index 0000000000..ddb2cd2b08
--- /dev/null
+++ b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java
@@ -0,0 +1,30 @@
+package org.baeldung.boot.converter;
+
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.core.convert.converter.ConverterFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class StringToEnumConverterFactory
+ implements ConverterFactory {
+
+ private static class StringToEnumConverter
+ implements Converter {
+
+ private Class enumType;
+
+ public StringToEnumConverter(Class enumType) {
+ this.enumType = enumType;
+ }
+
+ public T convert(String source) {
+ return (T) Enum.valueOf(this.enumType, source.trim());
+ }
+ }
+
+ @Override
+ public Converter getConverter(
+ Class targetType) {
+ return new StringToEnumConverter(targetType);
+ }
+}
\ No newline at end of file
diff --git a/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java b/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java
index e4e20de671..6b342a1bfb 100644
--- a/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java
+++ b/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java
@@ -13,7 +13,7 @@ public class MyCustomErrorController implements ErrorController {
@GetMapping(value = PATH)
public String error() {
- return "Error heaven";
+ return "Error haven";
}
@Override
diff --git a/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java b/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java
index d503f5da6d..3e26f8c9d8 100644
--- a/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java
+++ b/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java
@@ -14,9 +14,9 @@ public class ErrorController {
return "Error Code: 400 occured.";
}
- @GetMapping("/errorHeaven")
+ @GetMapping("/errorHaven")
String errorHeaven() {
- return "You have reached the heaven of errors!!!";
+ return "You have reached the haven of errors!!!";
}
}
diff --git a/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java b/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java
index 2d955bac9b..f6ab017298 100644
--- a/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java
+++ b/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java
@@ -19,7 +19,7 @@ public class MyServletContainerCustomizationBean implements WebServerFactoryCust
container.setContextPath("/springbootapp");
container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400"));
- container.addErrorPages(new ErrorPage("/errorHeaven"));
+ container.addErrorPages(new ErrorPage("/errorHaven"));
}
}
diff --git a/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java
index 1356de6d0e..bd1ae2c8fa 100644
--- a/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java
+++ b/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java
@@ -43,7 +43,7 @@ public class CustomConverterIntegrationTest {
@Test
public void whenConvertingToBigDecimalUsingGenericConverter_thenSuccess() {
- assertThat(conversionService.convert(Integer.valueOf(11), BigDecimal.class)).isEqualTo(BigDecimal.valueOf(11.00).setScale(0, BigDecimal.ROUND_HALF_EVEN));
+ assertThat(conversionService.convert(Integer.valueOf(11), BigDecimal.class)).isEqualTo(BigDecimal.valueOf(11.00).setScale(2, BigDecimal.ROUND_HALF_EVEN));
assertThat(conversionService.convert(Double.valueOf(25.23), BigDecimal.class)).isEqualByComparingTo(BigDecimal.valueOf(Double.valueOf(25.23)));
assertThat(conversionService.convert("2.32", BigDecimal.class)).isEqualTo(BigDecimal.valueOf(2.32));
}
diff --git a/spring-cloud-bus/spring-cloud-config-client/pom.xml b/spring-cloud-bus/spring-cloud-config-client/pom.xml
index 0c7d4648c4..bd9fb45587 100644
--- a/spring-cloud-bus/spring-cloud-config-client/pom.xml
+++ b/spring-cloud-bus/spring-cloud-config-client/pom.xml
@@ -12,9 +12,10 @@
Demo Spring Cloud Config Client
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.4.RELEASE
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-1
diff --git a/spring-cloud-bus/spring-cloud-config-client/src/main/resources/logback.xml b/spring-cloud-bus/spring-cloud-config-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-bus/spring-cloud-config-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientApplicationTests.java b/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java
similarity index 84%
rename from spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientApplicationTests.java
rename to spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java
index 3b361f385a..364368713a 100644
--- a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientApplicationTests.java
+++ b/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class SpringCloudConfigClientApplicationTests {
+public class SpringCloudConfigClientLiveTest {
@Test
public void contextLoads() {
diff --git a/spring-cloud-bus/spring-cloud-config-server/pom.xml b/spring-cloud-bus/spring-cloud-config-server/pom.xml
index 122f7bbce3..194289ea1e 100644
--- a/spring-cloud-bus/spring-cloud-config-server/pom.xml
+++ b/spring-cloud-bus/spring-cloud-config-server/pom.xml
@@ -12,9 +12,10 @@
Demo Spring Cloud Config Server
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.4.RELEASE
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-1
diff --git a/spring-cloud-bus/spring-cloud-config-server/src/main/resources/logback.xml b/spring-cloud-bus/spring-cloud-config-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-bus/spring-cloud-config-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-data-flow/batch-job/src/main/resources/logback.xml b/spring-cloud-data-flow/batch-job/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-data-flow/batch-job/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-data-flow/data-flow-server/pom.xml b/spring-cloud-data-flow/data-flow-server/pom.xml
index 3b04985618..0133d65978 100644
--- a/spring-cloud-data-flow/data-flow-server/pom.xml
+++ b/spring-cloud-data-flow/data-flow-server/pom.xml
@@ -11,10 +11,10 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.3.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-1
diff --git a/spring-cloud-data-flow/data-flow-server/src/main/resources/logback.xml b/spring-cloud-data-flow/data-flow-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-data-flow/data-flow-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-data-flow/data-flow-shell/src/main/resources/logback.xml b/spring-cloud-data-flow/data-flow-shell/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-data-flow/data-flow-shell/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-data-flow/log-sink/src/main/resources/logback.xml b/spring-cloud-data-flow/log-sink/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-data-flow/log-sink/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-data-flow/time-processor/src/main/resources/logback.xml b/spring-cloud-data-flow/time-processor/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-data-flow/time-processor/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-data-flow/time-source/src/main/resources/logback.xml b/spring-cloud-data-flow/time-source/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud-data-flow/time-source/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml
index c15387044a..773bf27fc2 100644
--- a/spring-cloud/spring-cloud-aws/pom.xml
+++ b/spring-cloud/spring-cloud-aws/pom.xml
@@ -10,10 +10,10 @@
Spring Cloud AWS Examples
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.8.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-aws/src/main/resources/logback.xml b/spring-cloud/spring-cloud-aws/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-aws/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/zipkin/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-bootstrap/zipkin/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml
index e782052b29..875aa5ceaa 100644
--- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml
+++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml
@@ -7,10 +7,10 @@
1.0.0-SNAPSHOT
- spring-boot-starter-parent
- org.springframework.boot
- 1.4.4.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/main/resources/logback.xml b/spring-cloud/spring-cloud-connectors-heroku/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-connectors-heroku/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-consul/src/main/resources/logback.xml b/spring-cloud/spring-cloud-consul/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-consul/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-gateway/src/main/resources/logback.xml b/spring-cloud/spring-cloud-gateway/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-gateway/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-hystrix/rest-producer/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-hystrix/rest-producer/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-ribbon-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-ribbon-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-ribbon-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-security/auth-client/pom.xml b/spring-cloud/spring-cloud-security/auth-client/pom.xml
index d4cd4d1856..f2d6308374 100644
--- a/spring-cloud/spring-cloud-security/auth-client/pom.xml
+++ b/spring-cloud/spring-cloud-security/auth-client/pom.xml
@@ -10,10 +10,10 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.9.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-security/auth-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-security/auth-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-security/auth-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-security/auth-client/src/test/java/com/example/springoath2/Springoath2ApplicationTests.java b/spring-cloud/spring-cloud-security/auth-client/src/test/java/com/example/springoath2/Springoath2ApplicationTests.java
index 5fa51a61c3..ca89575ee0 100644
--- a/spring-cloud/spring-cloud-security/auth-client/src/test/java/com/example/springoath2/Springoath2ApplicationTests.java
+++ b/spring-cloud/spring-cloud-security/auth-client/src/test/java/com/example/springoath2/Springoath2ApplicationTests.java
@@ -5,8 +5,10 @@ import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import com.baeldung.CloudSite;
+
@RunWith(SpringRunner.class)
-@SpringBootTest
+@SpringBootTest(classes = CloudSite.class)
public class Springoath2ApplicationTests {
@Test
diff --git a/spring-cloud/spring-cloud-security/auth-resource/pom.xml b/spring-cloud/spring-cloud-security/auth-resource/pom.xml
index e1ed33b46d..0115259108 100644
--- a/spring-cloud/spring-cloud-security/auth-resource/pom.xml
+++ b/spring-cloud/spring-cloud-security/auth-resource/pom.xml
@@ -12,10 +12,10 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.9.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-security/auth-resource/src/main/resources/logback.xml b/spring-cloud/spring-cloud-security/auth-resource/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-security/auth-resource/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-security/auth-server/pom.xml b/spring-cloud/spring-cloud-security/auth-server/pom.xml
index 4515ecd610..b4367935e3 100644
--- a/spring-cloud/spring-cloud-security/auth-server/pom.xml
+++ b/spring-cloud/spring-cloud-security/auth-server/pom.xml
@@ -7,9 +7,10 @@
0.0.1-SNAPSHOT
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.9.RELEASE
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-security/auth-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-security/auth-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-security/auth-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-stream-starters/boot/pom.xml b/spring-cloud/spring-cloud-stream-starters/boot/pom.xml
index b5a465d846..bf725da5cf 100644
--- a/spring-cloud/spring-cloud-stream-starters/boot/pom.xml
+++ b/spring-cloud/spring-cloud-stream-starters/boot/pom.xml
@@ -9,9 +9,10 @@
twitterhdfs
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.8.RELEASE
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-stream-starters/boot/src/main/resources/logback.xml b/spring-cloud/spring-cloud-stream-starters/boot/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-stream-starters/boot/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/main/resources/logback.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml
index c86c092b2e..afe609288d 100644
--- a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml
+++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml
@@ -6,10 +6,10 @@
0.0.1-SNAPSHOT
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.10.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/main/resources/logback.xml b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml
index 0acd197c50..fdcbabdd51 100644
--- a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml
+++ b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml
@@ -11,10 +11,10 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.10.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-1
diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/resources/logback.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java
similarity index 100%
rename from spring-cloud/spring-cloud-task/springcloudtasksink/src/main/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java
rename to spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-core/src/main/resources/logback.xml b/spring-core/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-core/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cucumber/src/main/resources/logback.xml b/spring-cucumber/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-cucumber/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-5-reactive/pom.xml b/spring-data-5-reactive/pom.xml
index 806eafa2d6..36ace53da2 100644
--- a/spring-data-5-reactive/pom.xml
+++ b/spring-data-5-reactive/pom.xml
@@ -8,10 +8,10 @@
jar
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.1.RELEASE
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
diff --git a/spring-data-5-reactive/src/main/resources/logback.xml b/spring-data-5-reactive/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-data-5-reactive/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-jpa/src/main/resources/logback.xml b/spring-data-jpa/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-data-jpa/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-keyvalue/pom.xml b/spring-data-keyvalue/pom.xml
index e6be025cb4..6ab928303d 100644
--- a/spring-data-keyvalue/pom.xml
+++ b/spring-data-keyvalue/pom.xml
@@ -6,10 +6,10 @@
1.0
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.1.RELEASE
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
diff --git a/spring-data-keyvalue/src/main/resources/logback.xml b/spring-data-keyvalue/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-data-keyvalue/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-rest-querydsl/pom.xml b/spring-data-rest-querydsl/pom.xml
index 251eb2d9bb..55ff78f0cb 100644
--- a/spring-data-rest-querydsl/pom.xml
+++ b/spring-data-rest-querydsl/pom.xml
@@ -8,9 +8,10 @@
spring-data-rest-querydsl
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.9.RELEASE
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
diff --git a/spring-data-rest-querydsl/src/main/resources/logback.xml b/spring-data-rest-querydsl/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-data-rest-querydsl/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-rest/src/main/resources/logback.xml b/spring-data-rest/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-data-rest/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-spring-security/src/main/resources/logback.xml b/spring-data-spring-security/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-data-spring-security/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-dispatcher-servlet/src/main/resources/logback.xml b/spring-dispatcher-servlet/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-dispatcher-servlet/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-drools/src/main/resources/logback.xml b/spring-drools/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-drools/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-ejb/ejb-beans/src/main/resources/logback.xml b/spring-ejb/ejb-beans/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-ejb/ejb-beans/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml b/spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-ejb/spring-ejb-client/src/main/resources/logback.xml b/spring-ejb/spring-ejb-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-ejb/spring-ejb-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-freemarker/src/main/resources/logback.xml b/spring-freemarker/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-freemarker/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-groovy/src/main/resources/logback.xml b/spring-groovy/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-groovy/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-hibernate3/src/main/resources/logback.xml b/spring-hibernate3/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-hibernate3/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-integration/src/main/resources/logback.xml b/spring-integration/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-integration/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-jenkins-pipeline/src/main/resources/logback.xml b/spring-jenkins-pipeline/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jenkins-pipeline/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-jinq/src/main/resources/logback.xml b/spring-jinq/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jinq/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-jms/src/main/resources/logback.xml b/spring-jms/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jms/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml
index 713f7eb5ad..e1c13ef774 100644
--- a/spring-jooq/pom.xml
+++ b/spring-jooq/pom.xml
@@ -5,10 +5,10 @@
0.0.1-SNAPSHOT
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.4.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
@@ -192,13 +192,13 @@
3.8.6
1.4.193
- 4.3.4.RELEASE
+ 4.3.17.RELEASE
1.0.0
1.5
1.0.0
- 1.4.4.RELEASE
-
+ 1.5.13.RELEASE
+ org.jooq.example.spring.Application
\ No newline at end of file
diff --git a/spring-jooq/src/main/resources/logback.xml b/spring-jooq/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jooq/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-kafka/src/main/resources/logback.xml b/spring-kafka/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-kafka/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-katharsis/src/main/resources/logback.xml b/spring-katharsis/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-katharsis/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mobile/src/main/resources/logback.xml b/spring-mobile/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mobile/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mockito/src/main/resources/logback.xml b/spring-mockito/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mockito/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mustache/pom.xml b/spring-mustache/pom.xml
index 3a53c63f8c..4e7a1ba5a3 100644
--- a/spring-mustache/pom.xml
+++ b/spring-mustache/pom.xml
@@ -11,11 +11,10 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.4.RELEASE
-
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
diff --git a/spring-mustache/src/main/resources/logback.xml b/spring-mustache/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mustache/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-forms-jsp/src/main/resources/logback.xml b/spring-mvc-forms-jsp/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mvc-forms-jsp/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-forms-thymeleaf/pom.xml b/spring-mvc-forms-thymeleaf/pom.xml
index 429bf3a5d4..07c49766ee 100644
--- a/spring-mvc-forms-thymeleaf/pom.xml
+++ b/spring-mvc-forms-thymeleaf/pom.xml
@@ -11,10 +11,10 @@
spring forms examples using thymeleaf
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.0.RELEASE
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml b/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md
index 6b05ef569c..c4a0e3579c 100644
--- a/spring-mvc-java/README.md
+++ b/spring-mvc-java/README.md
@@ -34,3 +34,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Core Annotations](http://www.baeldung.com/spring-core-annotations)
- [Using Spring ResponseEntity to Manipulate the HTTP Response](http://www.baeldung.com/spring-response-entity)
- [Using Spring @ResponseStatus to Set HTTP Status Code](http://www.baeldung.com/spring-response-status)
+- [Display RSS Feed with Spring MVC](http://www.baeldung.com/spring-mvc-rss-feed)
diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml
index 9c6f9b57a8..068824eba0 100644
--- a/spring-mvc-java/pom.xml
+++ b/spring-mvc-java/pom.xml
@@ -141,6 +141,13 @@
com.google.code.gson
gson
+
+
+
+ com.rometools
+ rome
+ ${rome.version}
+
@@ -283,7 +290,13 @@
3.16-beta1
+
+ 1.10.0
+
2.2.4
+
+
+ com.baeldung.app.Application
diff --git a/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomException.java b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomException.java
new file mode 100644
index 0000000000..4502a45301
--- /dev/null
+++ b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomException.java
@@ -0,0 +1,8 @@
+package com.baeldung.annotations;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+@ResponseStatus(code = HttpStatus.BAD_REQUEST)
+public class CustomException extends RuntimeException {
+}
diff --git a/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomResponseWithBuilderController.java b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomResponseWithBuilderController.java
new file mode 100644
index 0000000000..9a77029128
--- /dev/null
+++ b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomResponseWithBuilderController.java
@@ -0,0 +1,52 @@
+package com.baeldung.annotations;
+
+import java.time.Year;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Controller
+@RequestMapping("/customResponseWithBuilder")
+public class CustomResponseWithBuilderController {
+
+ @GetMapping("/hello")
+ public ResponseEntity hello() {
+ return ResponseEntity.ok("Hello World!");
+ }
+
+ @GetMapping("/age")
+ public ResponseEntity age(@RequestParam("yearOfBirth") int yearOfBirth) {
+ if (isInFuture(yearOfBirth)) {
+ return ResponseEntity.badRequest()
+ .body("Year of birth cannot be in the future");
+ }
+
+ return ResponseEntity.status(HttpStatus.OK)
+ .body("Your age is " + calculateAge(yearOfBirth));
+ }
+
+ private int calculateAge(int yearOfBirth) {
+ return currentYear() - yearOfBirth;
+ }
+
+ private boolean isInFuture(int year) {
+ return currentYear() < year;
+ }
+
+ private int currentYear() {
+ return Year.now()
+ .getValue();
+ }
+
+ @GetMapping("/customHeader")
+ public ResponseEntity customHeader() {
+ return ResponseEntity.ok()
+ .header("Custom-Header", "foo")
+ .body("Custom header set");
+ }
+
+}
diff --git a/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedApplication.java b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedApplication.java
new file mode 100644
index 0000000000..0f9de840d5
--- /dev/null
+++ b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedApplication.java
@@ -0,0 +1,23 @@
+package com.baeldung.rss;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * Spring Boot launcher for an application which exposes an RSS Feed.
+ *
+ * @author Donato Rimenti
+ *
+ */
+@SpringBootApplication
+public class RssFeedApplication {
+
+ /**
+ * Launches a Spring Boot application which exposes an RSS Feed.
+ *
+ * @param args null
+ */
+ public static void main(final String[] args) {
+ SpringApplication.run(RssFeedApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedController.java b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedController.java
new file mode 100644
index 0000000000..9d4e36dd5f
--- /dev/null
+++ b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedController.java
@@ -0,0 +1,32 @@
+package com.baeldung.rss;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.View;
+
+/**
+ * REST Controller which returns an RSS Feed created by {@link RssFeedView}.
+ *
+ * @author Donato Rimenti
+ *
+ */
+@RestController
+public class RssFeedController {
+
+ /**
+ * View used by this controller.
+ */
+ @Autowired
+ private RssFeedView view;
+
+ /**
+ * Returns an RSS Feed created by {@link #view}.
+ *
+ * @return an RSS Feed
+ */
+ @GetMapping("/rss")
+ public View getFeed() {
+ return view;
+ }
+}
diff --git a/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedView.java b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedView.java
new file mode 100644
index 0000000000..c9b9c51bec
--- /dev/null
+++ b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedView.java
@@ -0,0 +1,98 @@
+package com.baeldung.rss;
+
+import java.sql.Date;
+import java.time.Instant;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.view.feed.AbstractRssFeedView;
+
+import com.rometools.rome.feed.rss.Channel;
+import com.rometools.rome.feed.rss.Item;
+
+/**
+ * View for a RSS feed.
+ *
+ * @author Donato Rimenti
+ */
+@Component
+public class RssFeedView extends AbstractRssFeedView {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.springframework.web.servlet.view.feed.AbstractFeedView#
+ * buildFeedMetadata(java.util.Map, com.rometools.rome.feed.WireFeed,
+ * javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ protected void buildFeedMetadata(Map model, Channel feed, HttpServletRequest request) {
+ feed.setTitle("Baeldung RSS Feed");
+ feed.setDescription("Learn how to program in Java");
+ feed.setLink("http://www.baeldung.com");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.springframework.web.servlet.view.feed.AbstractRssFeedView#
+ * buildFeedItems(java.util.Map, javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ protected List- buildFeedItems(Map model, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // Builds the single entries.
+ Item entryOne = new Item();
+ entryOne.setTitle("JUnit 5 @Test Annotation");
+ entryOne.setAuthor("donatohan.rimenti@gmail.com");
+ entryOne.setLink("http://www.baeldung.com/junit-5-test-annotation");
+ entryOne.setPubDate(Date.from(Instant.parse("2017-12-19T00:00:00Z")));
+
+ Item entryTwo = new Item();
+ entryTwo.setTitle("Creating and Configuring Jetty 9 Server in Java");
+ entryTwo.setAuthor("donatohan.rimenti@gmail.com");
+ entryTwo.setLink("http://www.baeldung.com/jetty-java-programmatic");
+ entryTwo.setPubDate(Date.from(Instant.parse("2018-01-23T00:00:00Z")));
+
+ Item entryThree = new Item();
+ entryThree.setTitle("Flyweight Pattern in Java");
+ entryThree.setAuthor("donatohan.rimenti@gmail.com");
+ entryThree.setLink("http://www.baeldung.com/java-flyweight");
+ entryThree.setPubDate(Date.from(Instant.parse("2018-02-01T00:00:00Z")));
+
+ Item entryFour = new Item();
+ entryFour.setTitle("Multi-Swarm Optimization Algorithm in Java");
+ entryFour.setAuthor("donatohan.rimenti@gmail.com");
+ entryFour.setLink("http://www.baeldung.com/java-multi-swarm-algorithm");
+ entryFour.setPubDate(Date.from(Instant.parse("2018-03-09T00:00:00Z")));
+
+ Item entryFive = new Item();
+ entryFive.setTitle("A Simple Tagging Implementation with MongoDB");
+ entryFive.setAuthor("donatohan.rimenti@gmail.com");
+ entryFive.setLink("http://www.baeldung.com/mongodb-tagging");
+ entryFive.setPubDate(Date.from(Instant.parse("2018-03-27T00:00:00Z")));
+
+ Item entrySix = new Item();
+ entrySix.setTitle("Double-Checked Locking with Singleton");
+ entrySix.setAuthor("donatohan.rimenti@gmail.com");
+ entrySix.setLink("http://www.baeldung.com/java-singleton-double-checked-locking");
+ entrySix.setPubDate(Date.from(Instant.parse("2018-04-23T00:00:00Z")));
+
+ Item entrySeven = new Item();
+ entrySeven.setTitle("Introduction to Dagger 2");
+ entrySeven.setAuthor("donatohan.rimenti@gmail.com");
+ entrySeven.setLink("http://www.baeldung.com/dagger-2");
+ entrySeven.setPubDate(Date.from(Instant.parse("2018-06-30T00:00:00Z")));
+
+ // Creates the feed.
+ return Arrays.asList(entryOne, entryTwo, entryThree, entryFour, entryFive, entrySix, entrySeven);
+ }
+
+}
\ No newline at end of file
diff --git a/spring-mvc-java/src/test/java/com/baeldung/rss/RssFeedUnitTest.java b/spring-mvc-java/src/test/java/com/baeldung/rss/RssFeedUnitTest.java
new file mode 100644
index 0000000000..f5524c36fe
--- /dev/null
+++ b/spring-mvc-java/src/test/java/com/baeldung/rss/RssFeedUnitTest.java
@@ -0,0 +1,62 @@
+package com.baeldung.rss;
+
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+/**
+ * Test for {@link RssFeedApplication}.
+ *
+ * @author Donato Rimenti
+ *
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = RssFeedApplication.class)
+public class RssFeedUnitTest {
+
+ /**
+ * Application context.
+ */
+ @Autowired
+ private WebApplicationContext context;
+
+ /**
+ * Mock to perform tests on Spring Web Controller.
+ */
+ private MockMvc mvc;
+
+ /**
+ * Sets the test up.
+ */
+ @Before
+ public void setup() {
+ mvc = MockMvcBuilders.webAppContextSetup(context).build();
+ }
+
+ /**
+ * Calls the RSS feed endpoint and checks that the result matches an
+ * expected one.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void givenRssFeed_whenComparedWithExisting_thenEquals() throws Exception {
+ // The expected response.
+ String expectedResult = " Baeldung RSS Feed http://www.baeldung.com Learn how to program in Java
- JUnit 5 @Test Annotation http://www.baeldung.com/junit-5-test-annotation Tue, 19 Dec 2017 00:00:00 GMT donatohan.rimenti@gmail.com
- Creating and Configuring Jetty 9 Server in Java http://www.baeldung.com/jetty-java-programmatic Tue, 23 Jan 2018 00:00:00 GMT donatohan.rimenti@gmail.com
- Flyweight Pattern in Java http://www.baeldung.com/java-flyweight Thu, 01 Feb 2018 00:00:00 GMT donatohan.rimenti@gmail.com
- Multi-Swarm Optimization Algorithm in Java http://www.baeldung.com/java-multi-swarm-algorithm Fri, 09 Mar 2018 00:00:00 GMT donatohan.rimenti@gmail.com
- A Simple Tagging Implementation with MongoDB http://www.baeldung.com/mongodb-tagging Tue, 27 Mar 2018 00:00:00 GMT donatohan.rimenti@gmail.com
- Double-Checked Locking with Singleton http://www.baeldung.com/java-singleton-double-checked-locking Mon, 23 Apr 2018 00:00:00 GMT donatohan.rimenti@gmail.com
- Introduction to Dagger 2 http://www.baeldung.com/dagger-2 Sat, 30 Jun 2018 00:00:00 GMT donatohan.rimenti@gmail.com
";
+
+ // Performs a post against the RSS feed endpoint and checks that the
+ // result is equals to the expected one.
+ mvc.perform(MockMvcRequestBuilders.get("/rss")).andExpect(status().isOk())
+ .andExpect(content().xml(expectedResult));
+ }
+
+}
diff --git a/spring-mvc-kotlin/src/main/resources/logback.xml b/spring-mvc-kotlin/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mvc-kotlin/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-simple/pom.xml b/spring-mvc-simple/pom.xml
index b886750d37..bd63b5ed1c 100644
--- a/spring-mvc-simple/pom.xml
+++ b/spring-mvc-simple/pom.xml
@@ -59,6 +59,11 @@
spring-webmvc
${spring.version}
+
+ org.springframework
+ spring-tx
+ ${spring.version}
+
diff --git a/spring-mvc-simple/src/main/resources/logback.xml b/spring-mvc-simple/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mvc-simple/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/resources/logback.xml b/spring-mvc-velocity/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mvc-velocity/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mybatis/src/main/resources/logback.xml b/spring-mybatis/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mybatis/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-protobuf/src/main/resources/logback.xml b/spring-protobuf/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-protobuf/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-reactive-kotlin/README.md b/spring-reactive-kotlin/README.md
new file mode 100644
index 0000000000..cf5debc617
--- /dev/null
+++ b/spring-reactive-kotlin/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Spring Webflux with Kotlin](http://www.baeldung.com/spring-webflux-kotlin)
diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml
index 1425adc191..8eafe9f217 100644
--- a/spring-reactive-kotlin/pom.xml
+++ b/spring-reactive-kotlin/pom.xml
@@ -12,11 +12,11 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.3.RELEASE
-
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
+
UTF-8
diff --git a/spring-reactive-kotlin/src/main/resources/logback.xml b/spring-reactive-kotlin/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-reactive-kotlin/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-reactor/src/main/resources/logback.xml b/spring-reactor/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-reactor/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-amqp/remoting-amqp-client/src/main/resources/logback.xml b/spring-remoting/remoting-amqp/remoting-amqp-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-amqp/remoting-amqp-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-amqp/remoting-amqp-server/src/main/resources/logback.xml b/spring-remoting/remoting-amqp/remoting-amqp-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-amqp/remoting-amqp-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-hessian-burlap/client/src/main/resources/logback.xml b/spring-remoting/remoting-hessian-burlap/client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-hessian-burlap/client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-hessian-burlap/server/src/main/resources/logback.xml b/spring-remoting/remoting-hessian-burlap/server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-hessian-burlap/server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-http/client/src/main/resources/logback.xml b/spring-remoting/remoting-http/client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-http/client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-http/server/src/main/resources/logback.xml b/spring-remoting/remoting-http/server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-http/server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-jms/remoting-jms-client/src/main/resources/logback.xml b/spring-remoting/remoting-jms/remoting-jms-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-jms/remoting-jms-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/remoting-jms/remoting-jms-server/src/main/resources/logback.xml b/spring-remoting/remoting-jms/remoting-jms-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/remoting-jms/remoting-jms-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/resources/logback.xml b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/resources/logback.xml b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-rest-angular/src/main/resources/logback.xml b/spring-rest-angular/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-rest-angular/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-rest-embedded-tomcat/src/main/resources/logback.xml b/spring-rest-embedded-tomcat/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-rest-embedded-tomcat/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-rest-hal-browser/README.md b/spring-rest-hal-browser/README.md
new file mode 100644
index 0000000000..d9760c8295
--- /dev/null
+++ b/spring-rest-hal-browser/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Spring REST and HAL Browser](http://www.baeldung.com/spring-rest-hal)
diff --git a/spring-rest-hal-browser/src/main/resources/logback.xml b/spring-rest-hal-browser/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-rest-hal-browser/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-rest-shell/pom.xml b/spring-rest-shell/pom.xml
index e591c16427..2f7d1c8933 100644
--- a/spring-rest-shell/pom.xml
+++ b/spring-rest-shell/pom.xml
@@ -10,10 +10,10 @@
A simple project to demonstrate Spring REST Shell features.
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.8.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
diff --git a/spring-rest-shell/src/main/resources/logback.xml b/spring-rest-shell/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-rest-shell/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-rest-simple/README.md b/spring-rest-simple/README.md
index 9345cb70cc..ae853ba787 100644
--- a/spring-rest-simple/README.md
+++ b/spring-rest-simple/README.md
@@ -7,4 +7,4 @@
- [ETags for REST with Spring](http://www.baeldung.com/etags-for-rest-with-spring)
- [Spring and Apache FileUpload](http://www.baeldung.com/spring-apache-file-upload)
- [Spring RestTemplate Error Handling](http://www.baeldung.com/spring-rest-template-error-handling)
-
+- [Test a REST API with curl](http://www.baeldung.com/curl-rest)
diff --git a/spring-rest-simple/pom.xml b/spring-rest-simple/pom.xml
index f7981ee05c..f5ce46ade4 100644
--- a/spring-rest-simple/pom.xml
+++ b/spring-rest-simple/pom.xml
@@ -8,9 +8,10 @@
war
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.3.RELEASE
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
@@ -154,7 +155,7 @@
com.jayway.restassured
rest-assured
- ${rest-assured.version}
+ ${jayway-rest-assured.version}
com.google.protobuf
@@ -333,7 +334,7 @@
20.0
- 2.9.0
+ 2.9.0
1.6.0
diff --git a/spring-rest-template/README.md b/spring-rest-template/README.md
index bf35f0d32c..d69d5c01c7 100644
--- a/spring-rest-template/README.md
+++ b/spring-rest-template/README.md
@@ -2,3 +2,6 @@
### The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring
+
+### Relevant Articles:
+- [Uploading MultipartFile with Spring RestTemplate](http://www.baeldung.com/spring-rest-template-multipart-upload)
diff --git a/spring-rest-template/src/main/resources/logback.xml b/spring-rest-template/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-rest-template/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-roo/src/main/resources/logback.xml b/spring-roo/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-roo/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-acl/src/main/resources/logback.xml b/spring-security-acl/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-acl/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-anguar/server/src/main/resources/logback.xml b/spring-security-anguar/server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-anguar/server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-angular/server/src/main/resources/logback.xml b/spring-security-angular/server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-angular/server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-cache-control/src/main/resources/logback.xml b/spring-security-cache-control/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-cache-control/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authentication/src/main/resources/logback.xml b/spring-security-client/spring-security-jsp-authentication/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-authorize/src/main/resources/logback.xml b/spring-security-client/spring-security-jsp-authorize/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-jsp-config/src/main/resources/logback.xml b/spring-security-client/spring-security-jsp-config/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-mvc/src/main/resources/logback.xml b/spring-security-client/spring-security-mvc/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/logback.xml b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/logback.xml b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-client/spring-security-thymeleaf-config/src/main/resources/logback.xml b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-core/src/main/resources/logback.xml b/spring-security-core/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-core/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-mvc-boot/src/main/resources/logback.xml b/spring-security-mvc-boot/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-mvc-boot/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-mvc-login/README.md b/spring-security-mvc-login/README.md
index f7eb314869..c19cbc87a5 100644
--- a/spring-security-mvc-login/README.md
+++ b/spring-security-mvc-login/README.md
@@ -12,6 +12,7 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
- [Spring HTTP/HTTPS Channel Security](http://www.baeldung.com/spring-channel-security-https)
- [Spring Security - Customize the 403 Forbidden/Access Denied Page](http://www.baeldung.com/spring-security-custom-access-denied-page)
- [Spring Security – Redirect to the Previous URL After Login](http://www.baeldung.com/spring-security-redirect-login)
+- [Spring Security Custom AuthenticationFailureHandler](http://www.baeldung.com/spring-security-custom-authentication-failure-handler)
### Build the Project
```
diff --git a/spring-security-mvc-socket/pom.xml b/spring-security-mvc-socket/pom.xml
index b3155c3bf5..1f75becc98 100644
--- a/spring-security-mvc-socket/pom.xml
+++ b/spring-security-mvc-socket/pom.xml
@@ -11,9 +11,9 @@
com.baeldung
- parent-spring-4
+ parent-spring-5
0.0.1-SNAPSHOT
- ../parent-spring-4
+ ../parent-spring-5
@@ -56,12 +56,12 @@
org.springframework.security
spring-security-web
- ${springsecurity.version}
+ ${spring-security.version}
org.springframework.security
spring-security-config
- ${springsecurity.version}
+ ${spring-security.version}
@@ -95,7 +95,7 @@
org.springframework.security
spring-security-messaging
- ${springsecurity.version}
+ ${spring-security.version}
@@ -176,8 +176,6 @@
- 4.2.6.RELEASE
- 2.8.7
5.2.10.Final
1.11.3.RELEASE
1.4.196
diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java
index da687a328a..49b7ab2ff8 100644
--- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java
+++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java
@@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.resource.PathResourceResolver;
import org.springframework.web.servlet.view.JstlView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;
@@ -20,7 +20,7 @@ import java.sql.SQLException;
@EnableJpaRepositories
@ComponentScan("com.baeldung.springsecuredsockets")
@Import({ SecurityConfig.class, DataStoreConfig.class, SocketBrokerConfig.class, SocketSecurityConfig.class })
-public class AppConfig extends WebMvcConfigurerAdapter {
+public class AppConfig implements WebMvcConfigurer {
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
@@ -51,6 +51,6 @@ public class AppConfig extends WebMvcConfigurerAdapter {
// View H2
@Bean(initMethod="start", destroyMethod="stop")
public Server h2Console () throws SQLException {
- return Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8082");
+ return Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8084");
}
}
\ No newline at end of file
diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java
index 5affbd4c0e..941cac8392 100644
--- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java
+++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java
@@ -3,15 +3,15 @@ package com.baeldung.springsecuredsockets.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
-import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
+import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
@Configuration
@EnableWebSocketMessageBroker
@ComponentScan("com.baeldung.springsecuredsockets.controllers")
-public class SocketBrokerConfig extends AbstractWebSocketMessageBrokerConfigurer {
+public class SocketBrokerConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java
index 20311426c7..84c045a75a 100644
--- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java
+++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java
@@ -1,6 +1,5 @@
package com.baeldung.springsecuredsockets.config;
-import org.hibernate.cfg.Configuration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java
index 576495bedf..5b246ac380 100644
--- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java
+++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java
@@ -8,7 +8,6 @@ import org.springframework.security.authentication.dao.DaoAuthenticationProvider
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
public class CustomDaoAuthenticationProvider extends DaoAuthenticationProvider {
diff --git a/spring-security-mvc-socket/src/main/resources/logback.xml b/spring-security-mvc-socket/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-mvc-socket/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-openid/pom.xml b/spring-security-openid/pom.xml
index 108636ca8e..9c498f3700 100644
--- a/spring-security-openid/pom.xml
+++ b/spring-security-openid/pom.xml
@@ -11,10 +11,10 @@
Spring OpenID sample project
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.0.M7
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
diff --git a/spring-security-openid/src/main/resources/logback.xml b/spring-security-openid/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-openid/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-react/README.md b/spring-security-react/README.md
index a86cd6e7c4..1a845f0daa 100644
--- a/spring-security-react/README.md
+++ b/spring-security-react/README.md
@@ -2,12 +2,14 @@
## Spring Security React Example Project
-###The Course
+### The Course
The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
### Relevant Articles:
+* [Spring Security Login Page with React](http://www.baeldung.com/spring-security-login-react)
+
### Build the Project
```
diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java b/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java
index 56229d4d38..07057c3875 100644
--- a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java
+++ b/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java
@@ -30,7 +30,7 @@ public class AuthServerConfig extends AuthorizationServerConfigurerAdapter {
.authorizedGrantTypes("authorization_code")
.scopes("user_info")
.autoApprove(true)
- .redirectUris("http://localhost:8082/ui/login","http://localhost:8083/ui2/login")
+ .redirectUris("http://localhost:8082/ui/login","http://localhost:8083/ui2/login","http://localhost:8082/login")
// .accessTokenValiditySeconds(3600)
; // 1 hour
}
diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml b/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml b/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml b/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-stormpath/src/main/resources/logback.xml b/spring-security-stormpath/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-stormpath/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-thymeleaf/src/main/resources/logback.xml b/spring-security-thymeleaf/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-thymeleaf/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml b/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml b/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-session/README.md b/spring-session/README.md
index 733c9edfb9..30f70996cf 100644
--- a/spring-session/README.md
+++ b/spring-session/README.md
@@ -4,4 +4,4 @@
### Relevant Articles:
- [Introduction to Spring Session](http://www.baeldung.com/spring-session)
-- [Spring Session with JDBC](http://www.baeldung.com)
+- [Spring Session with JDBC](http://www.baeldung.com/spring-session-jdbc)
diff --git a/spring-session/spring-session-jdbc/README.MD b/spring-session/spring-session-jdbc/README.MD
index e22b7317c9..9293dfc953 100644
--- a/spring-session/spring-session-jdbc/README.MD
+++ b/spring-session/spring-session-jdbc/README.MD
@@ -3,4 +3,4 @@ Jira BAEL-1911
### Relevant Articles:
-- [Spring Session with JDBC](http://www.baeldung.com)
+- [Spring Session with JDBC](http://www.baeldung.com/spring-session-jdbc)
diff --git a/spring-session/spring-session-jdbc/src/main/resources/logback.xml b/spring-session/spring-session-jdbc/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-session/spring-session-jdbc/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-session/spring-session-redis/src/main/resources/logback.xml b/spring-session/spring-session-redis/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-session/spring-session-redis/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-sleuth/src/main/resources/logback.xml b/spring-sleuth/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-sleuth/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-social-login/src/main/resources/logback.xml b/spring-social-login/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-social-login/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-spel/src/main/resources/logback.xml b/spring-spel/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-spel/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-state-machine/src/main/resources/logback.xml b/spring-state-machine/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-state-machine/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/resources/logback.xml b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/main/resources/logback.xml b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-userservice/src/main/resources/logback.xml b/spring-userservice/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-userservice/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-vertx/pom.xml b/spring-vertx/pom.xml
index 339c72bcdf..4ba90b841e 100644
--- a/spring-vertx/pom.xml
+++ b/spring-vertx/pom.xml
@@ -11,11 +11,10 @@
A demo project with vertx spring integration
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.3.RELEASE
-
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
diff --git a/spring-vertx/src/main/resources/logback.xml b/spring-vertx/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-vertx/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-webflux-amqp/src/main/resources/logback.xml b/spring-webflux-amqp/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-webflux-amqp/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml b/spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-zuul/spring-zuul-ui/src/main/resources/logback.xml b/spring-zuul/spring-zuul-ui/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-zuul/spring-zuul-ui/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sse-jaxrs/pom.xml b/sse-jaxrs/pom.xml
new file mode 100644
index 0000000000..ac9bff937f
--- /dev/null
+++ b/sse-jaxrs/pom.xml
@@ -0,0 +1,22 @@
+
+
+ 4.0.0
+
+ com.baeldung.sse
+ sse-jaxrs
+ 1.0-SNAPSHOT
+ pom
+
+
+ 1.8
+ 1.8
+
+
+
+ sse-jaxrs-server
+ sse-jaxrs-client
+
+
+
diff --git a/sse-jaxrs/sse-jaxrs-client/pom.xml b/sse-jaxrs/sse-jaxrs-client/pom.xml
new file mode 100644
index 0000000000..a9068e133f
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-client/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+
+ com.baeldung.sse
+ sse-jaxrs
+ 1.0-SNAPSHOT
+
+
+ sse-jaxrs-client
+
+
+ 3.2.0
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.6.0
+
+
+ singleEvent
+
+ java
+
+
+ com.baeldung.sse.jaxrs.client.SseClientApp
+
+
+
+ broadcast
+
+ java
+
+
+ com.baeldung.sse.jaxrs.client.SseClientBroadcastApp
+
+
+
+
+
+
+
+
+
+ org.apache.cxf
+ cxf-rt-rs-client
+ ${cxf-version}
+
+
+ org.apache.cxf
+ cxf-rt-rs-sse
+ ${cxf-version}
+
+
+
+
diff --git a/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java
new file mode 100644
index 0000000000..5d42b3a243
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java
@@ -0,0 +1,48 @@
+package com.baeldung.sse.jaxrs.client;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.sse.InboundSseEvent;
+import javax.ws.rs.sse.SseEventSource;
+import java.util.function.Consumer;
+
+public class SseClientApp {
+
+ private static final String url = "http://127.0.0.1:9080/sse-jaxrs-server/sse/stock/prices";
+
+ public static void main(String... args) throws Exception {
+
+ Client client = ClientBuilder.newClient();
+ WebTarget target = client.target(url);
+ try (SseEventSource eventSource = SseEventSource.target(target).build()) {
+
+ eventSource.register(onEvent, onError, onComplete);
+ eventSource.open();
+
+ //Consuming events for one hour
+ Thread.sleep(60 * 60 * 1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ client.close();
+ System.out.println("End");
+ }
+
+ // A new event is received
+ private static Consumer onEvent = (inboundSseEvent) -> {
+ String data = inboundSseEvent.readData();
+ System.out.println(data);
+ };
+
+ //Error
+ private static Consumer onError = (throwable) -> {
+ throwable.printStackTrace();
+ };
+
+ //Connection close and there is nothing to receive
+ private static Runnable onComplete = () -> {
+ System.out.println("Done!");
+ };
+
+}
diff --git a/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java
new file mode 100644
index 0000000000..9afc187a6d
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java
@@ -0,0 +1,52 @@
+package com.baeldung.sse.jaxrs.client;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.sse.InboundSseEvent;
+import javax.ws.rs.sse.SseEventSource;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+
+public class SseClientBroadcastApp {
+
+ private static final String subscribeUrl = "http://localhost:9080/sse-jaxrs-server/sse/stock/subscribe";
+
+
+ public static void main(String... args) throws Exception {
+
+ Client client = ClientBuilder.newClient();
+ WebTarget target = client.target(subscribeUrl);
+ try (final SseEventSource eventSource = SseEventSource.target(target)
+ .reconnectingEvery(5, TimeUnit.SECONDS)
+ .build()) {
+ eventSource.register(onEvent, onError, onComplete);
+ eventSource.open();
+ System.out.println("Wainting for incoming event ...");
+
+ //Consuming events for one hour
+ Thread.sleep(60 * 60 * 1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ client.close();
+ System.out.println("End");
+ }
+
+ // A new event is received
+ private static Consumer onEvent = (inboundSseEvent) -> {
+ String data = inboundSseEvent.readData();
+ System.out.println(data);
+ };
+
+ //Error
+ private static Consumer onError = (throwable) -> {
+ throwable.printStackTrace();
+ };
+
+ //Connection close and there is nothing to receive
+ private static Runnable onComplete = () -> {
+ System.out.println("Done!");
+ };
+
+}
diff --git a/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml b/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sse-jaxrs/sse-jaxrs-server/pom.xml b/sse-jaxrs/sse-jaxrs-server/pom.xml
new file mode 100644
index 0000000000..1e89c70e13
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/pom.xml
@@ -0,0 +1,85 @@
+
+
+ 4.0.0
+
+
+ com.baeldung.sse
+ sse-jaxrs
+ 1.0-SNAPSHOT
+
+
+ sse-jaxrs-server
+ war
+
+
+ 2.4.2
+ false
+ 18.0.0.2
+
+
+
+ ${artifactId}
+
+
+ net.wasdev.wlp.maven.plugins
+ liberty-maven-plugin
+ ${liberty-maven-plugin.version}
+
+
+ io.openliberty
+ openliberty-webProfile8
+ ${openliberty-version}
+ zip
+
+ project
+ true
+ src/main/liberty/config/server.xml
+
+
+
+ install-server
+ prepare-package
+
+ install-server
+ create-server
+ install-feature
+
+
+
+ install-apps
+ package
+
+ install-apps
+
+
+
+
+
+
+
+
+
+
+ javax.ws.rs
+ javax.ws.rs-api
+ 2.1
+ provided
+
+
+ javax.enterprise
+ cdi-api
+ 2.0
+ provided
+
+
+ javax.json.bind
+ javax.json.bind-api
+ 1.0
+ provided
+
+
+
+
+
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java
new file mode 100644
index 0000000000..058d19f045
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java
@@ -0,0 +1,8 @@
+package com.baeldung.sse.jaxrs;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+@ApplicationPath("sse")
+public class AppConfig extends Application {
+}
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java
new file mode 100644
index 0000000000..1f60168a1b
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java
@@ -0,0 +1,119 @@
+package com.baeldung.sse.jaxrs;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.sse.OutboundSseEvent;
+import javax.ws.rs.sse.Sse;
+import javax.ws.rs.sse.SseBroadcaster;
+import javax.ws.rs.sse.SseEventSink;
+
+@ApplicationScoped
+@Path("stock")
+public class SseResource {
+
+ @Inject
+ private StockService stockService;
+
+ private Sse sse;
+ private SseBroadcaster sseBroadcaster;
+ private OutboundSseEvent.Builder eventBuilder;
+
+ @Context
+ public void setSse(Sse sse) {
+ this.sse = sse;
+ this.eventBuilder = sse.newEventBuilder();
+ this.sseBroadcaster = sse.newBroadcaster();
+ }
+
+ @GET
+ @Path("prices")
+ @Produces("text/event-stream")
+ public void getStockPrices(@Context SseEventSink sseEventSink,
+ @HeaderParam(HttpHeaders.LAST_EVENT_ID_HEADER) @DefaultValue("-1") int lastReceivedId) {
+
+ int lastEventId = 1;
+ if (lastReceivedId != -1) {
+ lastEventId = ++lastReceivedId;
+ }
+ boolean running = true;
+ while (running) {
+ Stock stock = stockService.getNextTransaction(lastEventId);
+ if (stock != null) {
+ OutboundSseEvent sseEvent = this.eventBuilder
+ .name("stock")
+ .id(String.valueOf(lastEventId))
+ .mediaType(MediaType.APPLICATION_JSON_TYPE)
+ .data(Stock.class, stock)
+ .reconnectDelay(3000)
+ .comment("price change")
+ .build();
+ sseEventSink.send(sseEvent);
+ lastEventId++;
+ }
+ //Simulate connection close
+ if (lastEventId % 5 == 0) {
+ sseEventSink.close();
+ break;
+ }
+
+ try {
+ //Wait 5 seconds
+ Thread.sleep(5 * 1000);
+ } catch (InterruptedException ex) {
+ // ...
+ }
+ //Simulatae a while boucle break
+ running = lastEventId <= 2000;
+ }
+ sseEventSink.close();
+ }
+
+ @GET
+ @Path("subscribe")
+ @Produces(MediaType.SERVER_SENT_EVENTS)
+ public void listen(@Context SseEventSink sseEventSink) {
+ sseEventSink.send(sse.newEvent("Welcome !"));
+ this.sseBroadcaster.register(sseEventSink);
+ sseEventSink.send(sse.newEvent("You are registred !"));
+ }
+
+ @GET
+ @Path("publish")
+ public void broadcast() {
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ int lastEventId = 0;
+ boolean running = true;
+ while (running) {
+ lastEventId++;
+ Stock stock = stockService.getNextTransaction(lastEventId);
+ if (stock != null) {
+ OutboundSseEvent sseEvent = eventBuilder
+ .name("stock")
+ .id(String.valueOf(lastEventId))
+ .mediaType(MediaType.APPLICATION_JSON_TYPE)
+ .data(Stock.class, stock)
+ .reconnectDelay(3000)
+ .comment("price change")
+ .build();
+ sseBroadcaster.broadcast(sseEvent);
+ }
+ try {
+ //Wait 5 seconds
+ Thread.currentThread().sleep(5 * 1000);
+ } catch (InterruptedException ex) {
+ // ...
+ }
+ //Simulatae a while boucle break
+ running = lastEventId <= 2000;
+ }
+ }
+ };
+ new Thread(r).start();
+ }
+}
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java
new file mode 100644
index 0000000000..a186b32771
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java
@@ -0,0 +1,50 @@
+package com.baeldung.sse.jaxrs;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+public class Stock {
+ private Integer id;
+ private String name;
+ private BigDecimal price;
+ LocalDateTime dateTime;
+
+ public Stock(Integer id, String name, BigDecimal price, LocalDateTime dateTime) {
+ this.id = id;
+ this.name = name;
+ this.price = price;
+ this.dateTime = dateTime;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public LocalDateTime getDateTime() {
+ return dateTime;
+ }
+
+ public void setDateTime(LocalDateTime dateTime) {
+ this.dateTime = dateTime;
+ }
+}
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java
new file mode 100644
index 0000000000..15818ead5d
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java
@@ -0,0 +1,78 @@
+package com.baeldung.sse.jaxrs;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Initialized;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
+
+@ApplicationScoped
+@Named
+public class StockService {
+
+ private static final BigDecimal UP = BigDecimal.valueOf(1.05f);
+ private static final BigDecimal DOWN = BigDecimal.valueOf(0.95f);
+
+ List stockNames = Arrays.asList("GOOG", "IBM", "MS", "GOOG", "YAHO");
+ List stocksDB = new ArrayList<>();
+ private AtomicInteger counter = new AtomicInteger(0);
+
+ public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
+ //Open price
+ System.out.println("@Start Init ...");
+ stockNames.forEach(stockName -> {
+ stocksDB.add(new Stock(counter.incrementAndGet(), stockName, generateOpenPrice(), LocalDateTime.now()));
+ });
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ //Simulate Change price and put every x seconds
+ while (true) {
+ int indx = new Random().nextInt(stockNames.size());
+ String stockName = stockNames.get(indx);
+ BigDecimal price = getLastPrice(stockName);
+ BigDecimal newprice = changePrice(price);
+ Stock stock = new Stock(counter.incrementAndGet(), stockName, newprice, LocalDateTime.now());
+ stocksDB.add(stock);
+
+ int r = new Random().nextInt(30);
+ try {
+ Thread.currentThread().sleep(r*1000);
+ } catch (InterruptedException ex) {
+ // ...
+ }
+ }
+ }
+ };
+ new Thread(runnable).start();
+ System.out.println("@End Init ...");
+ }
+
+ public Stock getNextTransaction(Integer lastEventId) {
+ return stocksDB.stream().filter(s -> s.getId().equals(lastEventId)).findFirst().orElse(null);
+ }
+
+ BigDecimal generateOpenPrice() {
+ float min = 70;
+ float max = 120;
+ return BigDecimal.valueOf(min + new Random().nextFloat() * (max - min)).setScale(4,RoundingMode.CEILING);
+ }
+
+ BigDecimal changePrice(BigDecimal price) {
+ return Math.random() >= 0.5 ? price.multiply(UP).setScale(4,RoundingMode.CEILING) : price.multiply(DOWN).setScale(4,RoundingMode.CEILING);
+ }
+
+ private BigDecimal getLastPrice(String stockName) {
+ return stocksDB.stream().filter(stock -> stock.getName().equals(stockName)).findFirst().get().getPrice();
+ }
+}
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml b/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml
new file mode 100644
index 0000000000..9bf66d7795
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml
@@ -0,0 +1,7 @@
+
+
+ jaxrs-2.1
+ cdi-2.0
+
+
+
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml b/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000000..4f0b3cdeeb
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml b/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..b4b8121fdd
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,11 @@
+
+
+ Hello Servlet
+
+
+ index.html
+
+
+
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html
new file mode 100644
index 0000000000..9015a7a32c
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html
@@ -0,0 +1 @@
+index
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html
new file mode 100644
index 0000000000..5a46e2a5d3
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html
@@ -0,0 +1,38 @@
+
+
+
+ Server-Sent Event Broadcasting
+
+
+Stock prices :
+
+
+
+
\ No newline at end of file
diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html
new file mode 100644
index 0000000000..8fddae4717
--- /dev/null
+++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html
@@ -0,0 +1,38 @@
+
+
+
+ Server-Sent Event
+
+
+Stock prices :
+
+
+
+
\ No newline at end of file
diff --git a/static-analysis/src/main/resources/logback.xml b/static-analysis/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/static-analysis/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/stripe/src/main/resources/logback.xml b/stripe/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/stripe/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/structurizr/src/main/resources/logback.xml b/structurizr/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/structurizr/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/struts-2/src/main/resources/logback.xml b/struts-2/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/struts-2/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml
index 2ef290a7c1..c60cc00c2c 100644
--- a/testing-modules/junit-5/pom.xml
+++ b/testing-modules/junit-5/pom.xml
@@ -33,6 +33,12 @@
${junit.vintage.version}
test
+
+ org.junit.jupiter
+ junit-jupiter-migrationsupport
+ ${junit.vintage.version}
+ test
+
org.apache.logging.log4j
log4j-core
@@ -54,6 +60,24 @@
spring-context
${spring.version}
+
+ org.powermock
+ powermock-module-junit4
+ ${powermock.version}
+ test
+
+
+ junit
+ junit
+
+
+
+
+ org.powermock
+ powermock-api-mockito2
+ ${powermock.version}
+ test
+
@@ -99,7 +123,8 @@
5.2.0
2.8.2
1.4.196
- 2.11.0
+ 2.8.9
+ 1.7.4
2.19.1
1.6.0
5.0.1.RELEASE
diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCalling.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCalling.java
similarity index 83%
rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCalling.java
rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCalling.java
index b0709bf6bf..e55c6b98e2 100644
--- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCalling.java
+++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCalling.java
@@ -1,7 +1,7 @@
/**
*
*/
-package org.baeldung.testing.abstractclass.abstractmethod;
+package com.baeldung.abstractclass.abstractmethod;
/**
* When method calls abstract method.
diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependent.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependent.java
similarity index 76%
rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependent.java
rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependent.java
index 7456a51c43..4dce2665d5 100644
--- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependent.java
+++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependent.java
@@ -1,4 +1,4 @@
-package org.baeldung.testing.abstractclass.indepedentmethod;
+package com.baeldung.abstractclass.indepedentmethod;
/**
* Test Independent Method
diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/ConcreteImpl.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/ConcreteImpl.java
similarity index 68%
rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/ConcreteImpl.java
rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/ConcreteImpl.java
index f568ad4eec..6e71b88946 100644
--- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/ConcreteImpl.java
+++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/ConcreteImpl.java
@@ -1,4 +1,4 @@
-package org.baeldung.testing.abstractclass.indepedentmethod;
+package com.baeldung.abstractclass.indepedentmethod;
public class ConcreteImpl extends AbstractIndependent {
diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFields.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFields.java
similarity index 87%
rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFields.java
rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFields.java
index 3761eb8c3b..262f72e393 100644
--- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFields.java
+++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFields.java
@@ -1,4 +1,4 @@
-package org.baeldung.testing.abstractclass.instancefields;
+package com.baeldung.abstractclass.instancefields;
/**
* Test Independent Method
diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethods.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethods.java
similarity index 84%
rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethods.java
rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethods.java
index 98a9bcaa07..fe7fb25931 100644
--- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethods.java
+++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethods.java
@@ -1,4 +1,4 @@
-package org.baeldung.testing.abstractclass.privatemethod;
+package com.baeldung.abstractclass.privatemethod;
import java.time.LocalDateTime;
diff --git a/testing-modules/junit-5/src/main/resources/logback.xml b/testing-modules/junit-5/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/testing-modules/junit-5/src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java
index 79ba882205..31b6e14d6c 100644
--- a/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java
+++ b/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java
@@ -11,14 +11,17 @@ import java.util.Optional;
import java.util.function.BooleanSupplier;
import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
/**
* Unit test that demonstrate the different assertions available within JUnit 4
*/
+@DisplayName("Test case for assertions")
public class AssertionUnitTest {
@Test
+ @DisplayName("Arrays should be equals")
public void whenAssertingArraysEquality_thenEqual() {
char[] expected = {'J', 'u', 'p', 'i', 't', 'e', 'r'};
char[] actual = "Jupiter".toCharArray();
@@ -27,6 +30,7 @@ public class AssertionUnitTest {
}
@Test
+ @DisplayName("The area of two polygons should be equal")
public void whenAssertingEquality_thenEqual() {
float square = 2 * 2;
float rectangle = 2 * 2;
diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java
index 7586a2f51a..299cac2480 100644
--- a/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java
+++ b/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java
@@ -10,13 +10,13 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
public class NestedUnitTest {
+
Stack