Merge branch 'master' of https://github.com/eugenp/tutorials
This commit is contained in:
commit
cdcca2cb65
|
@ -16,4 +16,8 @@ This module contains articles about algorithms. Some classes of algorithms, e.g.
|
|||
- [Maximum Subarray Problem](https://www.baeldung.com/java-maximum-subarray)
|
||||
- [How to Merge Two Sorted Arrays](https://www.baeldung.com/java-merge-sorted-arrays)
|
||||
- [Median of Stream of Integers using Heap](https://www.baeldung.com/java-stream-integers-median-using-heap)
|
||||
- [Kruskal’s Algorithm for Spanning Trees](https://www.baeldung.com/java-spanning-trees-kruskal)
|
||||
- [Balanced Brackets Algorithm in Java](https://www.baeldung.com/java-balanced-brackets-algorithm)
|
||||
- [Efficiently Merge Sorted Java Sequences](https://www.baeldung.com/java-merge-sorted-sequences)
|
||||
- [Introduction to Greedy Algorithms with Java](https://www.baeldung.com/java-greedy-algorithms)
|
||||
- More articles: [[<-- prev]](/../algorithms-miscellaneous-4)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Partitioning and Sorting Arrays with Many Repeated Entries](https://www.baeldung.com/java-sorting-arrays-with-repeated-entries)
|
|
@ -6,3 +6,6 @@ This module contains articles about Apache POI
|
|||
- [Microsoft Word Processing in Java with Apache POI](https://www.baeldung.com/java-microsoft-word-with-apache-poi)
|
||||
- [Working with Microsoft Excel in Java](https://www.baeldung.com/java-microsoft-excel)
|
||||
- [Creating a MS PowerPoint Presentation in Java](https://www.baeldung.com/apache-poi-slideshow)
|
||||
- [Merge Cells in Excel Using Apache POI](https://www.baeldung.com/java-apache-poi-merge-cells)
|
||||
- [Get String Value of Excel Cell with Apache POI](https://www.baeldung.com/java-apache-poi-cell-string-value)
|
||||
- [Read Excel Cell Value Rather Than Formula With Apache POI](https://github.com/eugenp/tutorials/tree/master/apache-poi)
|
||||
|
|
|
@ -3,3 +3,5 @@
|
|||
This module contains articles about Apache RocketMQ
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Apache RocketMQ with Spring Boot](https://www.baeldung.com/apache-rocketmq-spring-boot)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
### Relevant articles:
|
||||
|
||||
- [Java Switch Statement](https://www.baeldung.com/java-switch)
|
||||
- [New Java 13 Features](https://www.baeldung.com/java-13-new-features)
|
||||
|
|
|
@ -13,4 +13,5 @@ This module contains articles about Java arrays
|
|||
- [Removing an Element from an Array in Java](https://www.baeldung.com/java-array-remove-element)
|
||||
- [Removing the First Element of an Array](https://www.baeldung.com/java-array-remove-first-element)
|
||||
- [Adding an Element to a Java Array vs an ArrayList](https://www.baeldung.com/java-add-element-to-array-vs-list)
|
||||
- [Arrays.sort vs Arrays.parallelSort](https://www.baeldung.com/java-arrays-sort-vs-parallelsort)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-arrays)
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SortComparisonUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void givenArrayOfIntegers_whenUsingArraysSortMethodWithRange_thenSortRangeOfArrayInAscendingOrder() {
|
||||
public void givenArrayOfIntegers_whenUsingArraysSortWithRange_thenSortRangeOfArrayAsc() {
|
||||
int[] array = { 10, 4, 6, 2, 1, 9, 7, 8, 3, 5 };
|
||||
int[] expected = { 10, 4, 1, 2, 6, 7, 8, 9, 3, 5 };
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class SortComparisonUnitTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void givenArrayOfIntegers_whenUsingArraysParallelSortMethodWithRange_thenSortRangeOfArrayInAscendingOrder() {
|
||||
public void givenArrayOfIntegers_whenUsingArraysParallelSortWithRange_thenSortRangeOfArrayAsc() {
|
||||
int[] array = { 10, 4, 6, 2, 1, 9, 7, 8, 3, 5 };
|
||||
int[] expected = { 10, 4, 1, 2, 6, 7, 8, 9, 3, 5 };
|
||||
|
||||
|
|
|
@ -8,4 +8,6 @@ This module contains articles about advanced topics about multithreading with co
|
|||
|
||||
- [Common Concurrency Pitfalls in Java](https://www.baeldung.com/java-common-concurrency-pitfalls)
|
||||
- [Guide to RejectedExecutionHandler](https://www.baeldung.com/java-rejectedexecutionhandler)
|
||||
[[<-- previous]](/core-java-modules/core-java-concurrency-advanced-2)
|
||||
- [Guide to Work Stealing in Java](https://www.baeldung.com/java-work-stealing)
|
||||
- [Asynchronous Programming in Java](https://www.baeldung.com/java-asynchronous-programming)
|
||||
- [[<-- previous]](/core-java-modules/core-java-concurrency-advanced-2)
|
||||
|
|
|
@ -6,4 +6,5 @@ This module contains articles about date operations in Java.
|
|||
- [Skipping Weekends While Adding Days to LocalDate in Java 8](https://www.baeldung.com/java-localdate-add-days-skip-weekends)
|
||||
- [Checking If Two Java Dates Are on the Same Day](https://www.baeldung.com/java-check-two-dates-on-same-day)
|
||||
- [Converting Java Date to OffsetDateTime](https://www.baeldung.com/java-convert-date-to-offsetdatetime)
|
||||
- [How to Set the JVM Time Zone](https://www.baeldung.com/java-jvm-time-zone)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-date-operations-1)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Creating a LocalDate with Values in Java](https://www.baeldung.com/java-creating-localdate-with-values)
|
|
@ -6,3 +6,4 @@ This module contains articles about core java exceptions
|
|||
|
||||
- [Is It a Bad Practice to Catch Throwable?](https://www.baeldung.com/java-catch-throwable-bad-practice)
|
||||
- [Wrapping vs Rethrowing Exceptions in Java](https://www.baeldung.com/java-wrapping-vs-rethrowing-exceptions)
|
||||
- [java.net.UnknownHostException: Invalid Hostname for Server](https://www.baeldung.com/java-unknownhostexception)
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.baeldung.socketexception;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.Socket;
|
||||
|
||||
public class SocketClient {
|
||||
|
||||
private Socket clientSocket;
|
||||
private PrintWriter out;
|
||||
private BufferedReader in;
|
||||
|
||||
public void startConnection(String ip, int port) throws IOException {
|
||||
clientSocket = new Socket(ip, port);
|
||||
out = new PrintWriter(clientSocket.getOutputStream(), true);
|
||||
in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
|
||||
}
|
||||
|
||||
public String sendMessage(String msg) throws IOException {
|
||||
out.println(msg);
|
||||
return in.readLine();
|
||||
}
|
||||
|
||||
public void stopConnection() throws IOException {
|
||||
in.close();
|
||||
out.close();
|
||||
clientSocket.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.baeldung.socketexception;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
public class SocketServer {
|
||||
|
||||
private ServerSocket serverSocket;
|
||||
private Socket clientSocket;
|
||||
private PrintWriter out;
|
||||
private BufferedReader in;
|
||||
|
||||
public void start(int port) {
|
||||
try {
|
||||
serverSocket = new ServerSocket(port);
|
||||
clientSocket = serverSocket.accept();
|
||||
out = new PrintWriter(clientSocket.getOutputStream(), true);
|
||||
in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
|
||||
String msg = in.readLine();
|
||||
if (msg.contains("hi"))
|
||||
out.println("hi");
|
||||
else
|
||||
out.println("didn't understand");
|
||||
close();
|
||||
stop();
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void close() throws IOException {
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
|
||||
private void stop() throws IOException {
|
||||
clientSocket.close();
|
||||
serverSocket.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.baeldung.socketexception;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SocketExceptionHandlingUnitTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void runServer() throws IOException, InterruptedException {
|
||||
Executors.newSingleThreadExecutor()
|
||||
.submit(() -> new SocketServer().start(6699));
|
||||
Thread.sleep(100);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenRunningServer_whenConnectToClosedSocket_thenHandleException() throws IOException {
|
||||
SocketClient client = new SocketClient();
|
||||
client.startConnection("127.0.0.1", 6699);
|
||||
try {
|
||||
client.sendMessage("hi");
|
||||
client.sendMessage("hi again");
|
||||
} catch (SocketException e) {
|
||||
client.stopConnection();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -7,4 +7,6 @@ This module contains articles about core features in the Java language
|
|||
- [Command-Line Arguments in Java](https://www.baeldung.com/java-command-line-arguments)
|
||||
- [What is a POJO Class?](https://www.baeldung.com/java-pojo-class)
|
||||
- [Java Default Parameters Using Method Overloading](https://www.baeldung.com/java-default-parameters-method-overloading)
|
||||
- [How to Return Multiple Values From a Java Method](https://www.baeldung.com/java-method-return-multiple-values)
|
||||
- [Guide to the Java finally Keyword](https://www.baeldung.com/java-finally-keyword)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-lang)
|
||||
|
|
|
@ -9,3 +9,4 @@
|
|||
- [The strictfp Keyword in Java](https://www.baeldung.com/java-strictfp)
|
||||
- [Basic Calculator in Java](https://www.baeldung.com/java-basic-calculator)
|
||||
- [Overflow and Underflow in Java](https://www.baeldung.com/java-overflow-underflow)
|
||||
- [Obtaining a Power Set of a Set in Java](https://www.baeldung.com/java-power-set-of-a-set)
|
||||
|
|
|
@ -12,4 +12,5 @@ This module contains articles about Java syntax
|
|||
- [Variable Scope in Java](https://www.baeldung.com/java-variable-scope)
|
||||
- [Introduction to Basic Syntax in Java](https://www.baeldung.com/java-syntax)
|
||||
- [Java ‘protected’ Access Modifier](https://www.baeldung.com/java-protected-access-modifier)
|
||||
- [Using the Not Operator in If Conditions in Java](https://www.baeldung.com/java-using-not-in-if-conditions)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-lang-syntax)
|
||||
|
|
|
@ -13,4 +13,7 @@ This module contains articles about Java syntax
|
|||
- [Infinite Loops in Java](https://www.baeldung.com/infinite-loops-java)
|
||||
- [Java Switch Statement](https://www.baeldung.com/java-switch)
|
||||
- [Breaking Out of Nested Loops](https://www.baeldung.com/java-breaking-out-nested-loop)
|
||||
- [Java Do-While Loop](https://www.baeldung.com/java-do-while-loop)
|
||||
- [Java While Loop](https://www.baeldung.com/java-while-loop)
|
||||
- [Java For Loop](https://www.baeldung.com/java-for-loop)
|
||||
- [[More -->]](/core-java-modules/core-java-lang-syntax-2)
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
- [Guide to Java Reflection](http://www.baeldung.com/java-reflection)
|
||||
- [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection)
|
||||
- [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params)
|
||||
- [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies)
|
||||
- [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies)
|
||||
- [What Causes java.lang.reflect.InvocationTargetException?](https://www.baeldung.com/java-lang-reflect-invocationtargetexception)
|
||||
|
|
|
@ -5,4 +5,6 @@
|
|||
### Relevant Articles:
|
||||
- [An Overview of Regular Expressions Performance in Java](https://www.baeldung.com/java-regex-performance)
|
||||
- [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java)
|
||||
- [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char)
|
||||
- [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char)
|
||||
- [Pre-compile Regex Patterns Into Pattern Objects](https://www.baeldung.com/java-regex-pre-compile)
|
||||
- [Difference Between Java Matcher find() and matches()](https://www.baeldung.com/java-matcher-find-vs-matches)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
=========
|
||||
|
||||
## Core Java 8 Cookbooks and Examples
|
||||
|
||||
### Relevant Articles:
|
||||
- [An Overview of Regular Expressions Performance in Java](https://www.baeldung.com/java-regex-performance)
|
||||
- [Pre-compile Regex Patterns Into Pattern Objects](https://www.baeldung.com/java-regex-pre-compile)
|
|
@ -4,5 +4,5 @@ This module contains articles about Kotlin core features.
|
|||
|
||||
### Relevant articles:
|
||||
- [Working with Dates in Kotlin](https://www.baeldung.com/kotlin-dates)
|
||||
- [Kotlin Ternary Conditional Operator](https://www.baeldung.com/kotlin-ternary-conditional-operator)
|
||||
- [Kotlin Ternary Conditional Operator](https://www.baeldung.com/kotlin-ternary-operator)
|
||||
- [[<-- Prev]](/core-kotlin-modules/core-kotlin)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
This module contains articles about Kotlin core features.
|
||||
|
||||
### Relevant articles:
|
||||
- [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin)
|
||||
- [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin-intro)
|
||||
- [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability)
|
||||
- [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number)
|
||||
- [Create a Java and Kotlin Project with Maven](https://www.baeldung.com/kotlin-maven-java-project)
|
||||
|
|
|
@ -8,3 +8,4 @@ This module contains articles about data structures in Java
|
|||
- [Implementing a Binary Tree in Java](https://www.baeldung.com/java-binary-tree)
|
||||
- [Circular Linked List Java Implementation](https://www.baeldung.com/java-circular-linked-list)
|
||||
- [How to Print a Binary Tree Diagram](https://www.baeldung.com/java-print-binary-tree-diagram)
|
||||
- [Introduction to Big Queue](https://www.baeldung.com/java-big-queue)
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
# Dropwizard
|
||||
# Dropwizard
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Introduction to Dropwizard](https://www.baeldung.com/java-dropwizard)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Generating Random Numbers](https://www.baeldung.com/java-generating-random-numbers)
|
||||
- [Convert Double to Long in Java](https://www.baeldung.com/java-convert-double-long)
|
|
@ -3,3 +3,4 @@
|
|||
This module contains articles about JSON.
|
||||
|
||||
### Relevant Articles:
|
||||
- [Introduction to Jsoniter](https://www.baeldung.com/java-jsoniter)
|
||||
|
|
|
@ -9,3 +9,5 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m
|
|||
|
||||
### Relevant Articles:
|
||||
- [Parsing Command-Line Parameters with JCommander](https://www.baeldung.com/jcommander-parsing-command-line-parameters)
|
||||
- [Guide to the Cactoos Library](https://www.baeldung.com/java-cactoos)
|
||||
- [Parsing Command-Line Parameters with Airline](https://www.baeldung.com/java-airline)
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
package com.baeldung.libraries.snakeyaml;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MultiLineStringsUnitTest {
|
||||
|
||||
private Yaml yaml;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
yaml = new Yaml();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenLiteral_ThenLineBreaksArePresent() {
|
||||
String key = parseYamlKey("literal.yaml", "key");
|
||||
assertEquals("Line1\nLine2\nLine3", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenLiteral_ThenEndingBreaksAreReducedToOne() {
|
||||
String key = parseYamlKey("literal2.yaml", "key");
|
||||
assertEquals("\n\nLine1\n\nLine2\n\nLine3\n", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenFolded_ThenLineBreaksAreReplaced() {
|
||||
String key = parseYamlKey("folded.yaml", "key");
|
||||
assertEquals("Line1 Line2 Line3", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenFolded_ThenEmptyLinesAreReducedToOne() {
|
||||
String key = parseYamlKey("folded2.yaml", "key");
|
||||
assertEquals("Line1 Line2\n\nLine3\n", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenLiteralKeep_ThenLastEmptyLinesArePresent() {
|
||||
String key = parseYamlKey("literal_keep.yaml", "key");
|
||||
assertEquals("Line1\nLine2\nLine3\n\n", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenLiteralStrip_ThenLastEmptyLinesAreRemoved() {
|
||||
String key = parseYamlKey("literal_strip.yaml", "key");
|
||||
assertEquals("Line1\nLine2\nLine3", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenFoldedKeep_ThenLastEmptyLinesArePresent() {
|
||||
String key = parseYamlKey("folded_keep.yaml", "key");
|
||||
assertEquals("Line1 Line2 Line3\n\n\n", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenFoldedStrip_ThenLastEmptyLinesAreRemoved() {
|
||||
String key = parseYamlKey("folded_strip.yaml", "key");
|
||||
assertEquals("Line1 Line2 Line3", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenDoubleQuotes_ThenExplicitBreaksArePreserved() {
|
||||
String key = parseYamlKey("plain_double_quotes.yaml", "key");
|
||||
assertEquals("Line1\nLine2\nLine3", key);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSingleQuotes_ThenExplicitBreaksAreIgnored() {
|
||||
String key = parseYamlKey("plain_single_quotes.yaml", "key");
|
||||
assertEquals("Line1\\nLine2\nLine3", key);
|
||||
}
|
||||
|
||||
String parseYamlKey(String fileName, String key) {
|
||||
InputStream inputStream = this.getClass()
|
||||
.getClassLoader()
|
||||
.getResourceAsStream("yaml" + File.separator + "multiline" + File.separator + fileName);
|
||||
Map<String, String> parsed = yaml.load(inputStream);
|
||||
return parsed.get(key);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
key: >
|
||||
Line1
|
||||
Line2
|
||||
Line3
|
|
@ -0,0 +1,8 @@
|
|||
key: >
|
||||
Line1
|
||||
Line2
|
||||
|
||||
|
||||
Line3
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
key: >+
|
||||
Line1
|
||||
Line2
|
||||
Line3
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
key: >-
|
||||
Line1
|
||||
Line2
|
||||
Line3
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
key: |
|
||||
Line1
|
||||
Line2
|
||||
Line3
|
|
@ -0,0 +1,10 @@
|
|||
key: |
|
||||
|
||||
|
||||
Line1
|
||||
|
||||
Line2
|
||||
|
||||
Line3
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
key: |+
|
||||
Line1
|
||||
Line2
|
||||
Line3
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
key: |-
|
||||
Line1
|
||||
Line2
|
||||
Line3
|
||||
|
|
@ -0,0 +1 @@
|
|||
key: "Line1\nLine2\nLine3"
|
|
@ -0,0 +1,3 @@
|
|||
key: 'Line1\nLine2
|
||||
|
||||
Line3'
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
- [Get Log Output in JSON](https://www.baeldung.com/java-log-json-output)
|
||||
- [SLF4J Warning: Class Path Contains Multiple SLF4J Bindings](https://www.baeldung.com/slf4j-classpath-multiple-bindings)
|
||||
- [Sending Emails with Logback](https://www.baeldung.com/logback-send-email)
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
- [Intro to Jedis – the Java Redis Client Library](http://www.baeldung.com/jedis-java-redis-client-library)
|
||||
- [A Guide to Redis with Redisson](http://www.baeldung.com/redis-redisson)
|
||||
- [Introduction to Lettuce – the Java Redis Client](https://www.baeldung.com/java-redis-lettuce)
|
||||
- [List All Available Redis Keys](https://www.baeldung.com/redis-list-available-keys)
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
- [LIKE Queries in Spring JPA Repositories](https://www.baeldung.com/spring-jpa-like-queries)
|
||||
- [A Guide to Spring’s Open Session In View](https://www.baeldung.com/spring-open-session-in-view)
|
||||
- [Programmatic Transaction Management in Spring](https://www.baeldung.com/spring-programmatic-transaction-management)
|
||||
- [JPA Entity Lifecycle Events](https://www.baeldung.com/jpa-entity-lifecycle-events)
|
||||
- [Working with Lazy Element Collections in JPA](https://www.baeldung.com/java-jpa-lazy-collections)
|
||||
|
||||
### Eclipse Config
|
||||
After importing the project into Eclipse, you may see the following error:
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -641,7 +641,6 @@
|
|||
<module>spring-boot-modules</module>
|
||||
<module>spring-boot-parent</module>
|
||||
<module>spring-boot-rest</module>
|
||||
<module>spring-boot-security</module>
|
||||
|
||||
<module>spring-caching</module>
|
||||
|
||||
|
@ -1144,7 +1143,6 @@
|
|||
<module>spring-boot-modules</module>
|
||||
<module>spring-boot-parent</module>
|
||||
<module>spring-boot-rest</module>
|
||||
<module>spring-boot-security</module>
|
||||
|
||||
<module>spring-caching</module>
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [How to Create a Slack Plugin in Java](https://www.baeldung.com/java-slack-plugin)
|
|
@ -46,6 +46,7 @@
|
|||
<module>spring-boot-properties</module>
|
||||
<module>spring-boot-property-exp</module>
|
||||
<module>spring-boot-runtime</module>
|
||||
<module>spring-boot-security</module>
|
||||
<module>spring-boot-springdoc</module>
|
||||
<module>spring-boot-testing</module>
|
||||
<module>spring-boot-vue</module>
|
||||
|
|
|
@ -9,3 +9,5 @@ This module contains articles about configuring the Spring Boot build process.
|
|||
- [Introduction to WebJars](https://www.baeldung.com/maven-webjars)
|
||||
- [A Quick Guide to Maven Wrapper](https://www.baeldung.com/maven-wrapper)
|
||||
- [Running a Spring Boot App with Maven vs an Executable War/Jar](https://www.baeldung.com/spring-boot-run-maven-vs-executable-jar)
|
||||
- [Injecting Git Information Into Spring](https://www.baeldung.com/spring-git-information)
|
||||
- [Guide to Creating and Running a Jar File in Java](https://www.baeldung.com/java-create-jar)
|
||||
|
|
|
@ -139,6 +139,33 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>${git-commit-id-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>get-the-git-infos</id>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
<phase>initialize</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>validate-the-git-infos</id>
|
||||
<goals>
|
||||
<goal>validateRevision</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<generateGitPropertiesFile>true</generateGitPropertiesFile>
|
||||
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -185,6 +212,7 @@
|
|||
<jquery.version>3.1.1</jquery.version>
|
||||
<bootstrap.version>3.3.7-1</bootstrap.version>
|
||||
<jpa.version>2.2</jpa.version>
|
||||
<git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version>
|
||||
<guava.version>18.0</guava.version>
|
||||
<subethasmtp.version>3.1.7</subethasmtp.version>
|
||||
<springcloud.version>2.0.2.RELEASE</springcloud.version>
|
||||
|
|
|
@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
|||
- [Create a Custom Auto-Configuration with Spring Boot](https://www.baeldung.com/spring-boot-custom-auto-configuration)
|
||||
- [Guide to ApplicationContextRunner in Spring Boot](https://www.baeldung.com/spring-boot-context-runner)
|
||||
- [A Guide to Spring Boot Configuration Metadata](https://www.baeldung.com/spring-boot-configuration-metadata)
|
||||
- [Display Auto-Configuration Report in Spring Boot](https://www.baeldung.com/spring-boot-auto-configuration-report)
|
|
@ -9,3 +9,4 @@ This module contains articles about Spring Boot with Spring Data
|
|||
- [Disable Spring Data Auto Configuration](https://www.baeldung.com/spring-data-disable-auto-config)
|
||||
- [Repositories with Multiple Spring Data Modules](https://www.baeldung.com/spring-multiple-data-modules)
|
||||
- [Spring Custom Property Editor](https://www.baeldung.com/spring-mvc-custom-property-editor)
|
||||
- [Using @JsonComponent in Spring Boot](https://www.baeldung.com/spring-boot-jsoncomponent)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.boot.jsoncomponent;
|
||||
package com.baeldung.boot.jsoncomponent;
|
||||
|
||||
import javafx.scene.paint.Color;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.boot.jsoncomponent;
|
||||
package com.baeldung.boot.jsoncomponent;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.boot.jsoncomponent;
|
||||
package com.baeldung.boot.jsoncomponent;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.boot.jsoncomponent;
|
||||
package com.baeldung.boot.jsoncomponent;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
@ -1,9 +1,9 @@
|
|||
package org.baeldung.boot.jsoncomponent;
|
||||
package com.baeldung.boot.jsoncomponent;
|
||||
|
||||
import com.baeldung.boot.jsoncomponent.User;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import org.baeldung.boot.jsoncomponent.User;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -1,5 +1,6 @@
|
|||
package org.baeldung.boot.jsoncomponent;
|
||||
package com.baeldung.boot.jsoncomponent;
|
||||
|
||||
import com.baeldung.boot.jsoncomponent.User;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import javafx.scene.paint.Color;
|
||||
|
@ -11,8 +12,6 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.baeldung.boot.jsoncomponent.User;
|
||||
|
||||
@JsonTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class UserJsonSerializerIntegrationTest {
|
|
@ -5,5 +5,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects.
|
|||
### Relevant Articles:
|
||||
|
||||
- [Functional Controllers in Spring MVC](https://www.baeldung.com/spring-mvc-functional-controllers)
|
||||
- [Specify an array of strings as body parameter in Swagger API](https://www.baeldung.com/swagger-body-array-of-strings)
|
||||
- [Specify an Array of Strings as Body Parameters in Swagger](https://www.baeldung.com/swagger-body-array-of-strings)
|
||||
- More articles: [[prev -->]](/spring-boot-mvc)
|
||||
|
|
|
@ -5,3 +5,4 @@ This module contains articles about Spring Boot performance.
|
|||
### Relevant Articles
|
||||
|
||||
- [Lazy Initialization in Spring Boot 2](https://www.baeldung.com/spring-boot-lazy-initialization)
|
||||
- [Introduction to Chaos Monkey](https://www.baeldung.com/spring-boot-chaos-monkey)
|
||||
|
|
|
@ -19,6 +19,17 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>chaos-monkey-spring-boot</artifactId>
|
||||
<version>${chaos.monkey.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -41,5 +52,6 @@
|
|||
<properties>
|
||||
<!-- The main class to start by executing java -jar -->
|
||||
<start-class>com.baeldung.lazyinitialization.Application</start-class>
|
||||
<chaos.monkey.version>2.0.0</chaos.monkey.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#chaos monkey for spring boot props
|
||||
management.endpoint.chaosmonkey.enabled=true
|
||||
management.endpoint.chaosmonkeyjmx.enabled=true
|
||||
|
||||
spring.profiles.active=chaos-monkey
|
||||
#Determine whether should execute or not
|
||||
chaos.monkey.enabled=true
|
||||
#How many requests are to be attacked. 1: attack each request; 5: each 5th request is attacked
|
||||
chaos.monkey.assaults.level=1
|
||||
#Minimum latency in ms added to the request
|
||||
chaos.monkey.assaults.latencyRangeStart=3000
|
||||
#Maximum latency in ms added to the request
|
||||
chaos.monkey.assaults.latencyRangeEnd=15000
|
||||
#Latency assault active
|
||||
chaos.monkey.assaults.latencyActive=true
|
||||
#Exception assault active
|
||||
chaos.monkey.assaults.exceptionsActive=false
|
||||
#AppKiller assault active
|
||||
chaos.monkey.assaults.killApplicationActive=false
|
||||
#Controller watcher active
|
||||
chaos.monkey.watcher.controller=false
|
||||
#RestController watcher active
|
||||
chaos.monkey.watcher.restController=false
|
||||
#Service watcher active
|
||||
chaos.monkey.watcher.service=true
|
||||
#Repository watcher active
|
||||
chaos.monkey.watcher.repository=false
|
||||
#Component watcher active
|
||||
chaos.monkey.watcher.component=false
|
|
@ -7,6 +7,7 @@ This module contains articles about Spring Boot Security
|
|||
- [Spring Boot Security Auto-Configuration](https://www.baeldung.com/spring-boot-security-autoconfiguration)
|
||||
- [Spring Security for Spring Boot Integration Tests](https://www.baeldung.com/spring-security-integration-tests)
|
||||
- [Introduction to Spring Security Taglibs](https://www.baeldung.com/spring-security-taglibs)
|
||||
- [Guide to @CurrentSecurityContext in Spring Security](https://www.baeldung.com/spring-currentsecuritycontext)
|
||||
|
||||
### Spring Boot Security Auto-Configuration
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue