Merge pull request #8 from eugenp/master

fork update 11-nov_19 - 1
This commit is contained in:
AlNiyas 2019-11-11 20:07:08 +03:00 committed by GitHub
commit 15e0ab6a62
58 changed files with 364 additions and 153 deletions

View File

@ -1,4 +1,4 @@
package com.baeldung.list; package com.baeldung.list.duplicatescounter;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;

View File

@ -33,9 +33,9 @@ public class CollectionFilteringUnitTest {
for (Employee employee : originalList) { for (Employee employee : originalList) {
for (String name : nameFilter) { for (String name : nameFilter) {
if (employee.getName() if (employee.getName().equals(name)) {
.equalsIgnoreCase(name)) {
filteredList.add(employee); filteredList.add(employee);
//break;
} }
} }
} }

View File

@ -1,4 +1,4 @@
package com.baeldung.list; package com.baeldung.list.duplicatescounter;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -11,148 +11,171 @@ import static org.junit.Assert.*;
public class FileClassDemoUnitTest { public class FileClassDemoUnitTest {
@Test @Test
public void givenDirectoryCreated_whenMkdirIsInvoked_thenDirectoryIsDeleted() { public void givenDir_whenMkdir_thenDirIsDeleted() {
File directory = new File("testDirectory"); File directory = new File("dir");
if (!directory.isDirectory() || !directory.exists()) { assertTrue(directory.mkdir());
directory.mkdir();
}
assertTrue(directory.delete()); assertTrue(directory.delete());
} }
@Test @Test
public void givenFileCreated_whenCreateNewFileIsInvoked_thenFileIsDeleted() throws IOException { public void givenFile_whenCreateNewFile_thenFileIsDeleted() {
File file = new File("testFile.txt"); File file = new File("file.txt");
if (!file.isFile() || !file.exists()) { try {
file.createNewFile(); assertTrue(file.createNewFile());
} catch (IOException e) {
fail("Could not create " + "file.txt");
} }
assertTrue(file.delete()); assertTrue(file.delete());
} }
@Test
public void givenFile_whenCreateNewFile_thenMetadataIsCorrect() {
String sep = File.separator;
File parentDir = makeDir("filesDir");
File child = new File(parentDir, "file.txt");
try {
child.createNewFile();
} catch (IOException e) {
fail("Could not create " + "file.txt");
}
assertEquals("file.txt", child.getName());
assertEquals(parentDir.getName(), child.getParentFile().getName());
assertEquals(parentDir.getPath() + sep + "file.txt", child.getPath());
removeDir(parentDir);
}
@Test @Test
public void givenFileCreated_whenCreateNewFileInvoked_thenMetadataIsAsExpected() throws IOException { public void givenReadOnlyFile_whenCreateNewFile_thenCantModFile() {
File parentDir = makeDir("readDir");
// different Operating systems have different separator characters File child = new File(parentDir, "file.txt");
String separatorCharacter = System.getProperty("file.separator"); try {
child.createNewFile();
File parentDirectory = makeDirectory("filesDirectory"); } catch (IOException e) {
fail("Could not create " + "file.txt");
File childFile = new File(parentDirectory, "file1.txt"); }
childFile.createNewFile(); child.setWritable(false);
boolean writable = true;
assertTrue(childFile.getName().equals("file1.txt")); try (FileOutputStream fos = new FileOutputStream(child)) {
assertTrue(childFile.getParentFile().getName().equals(parentDirectory.getName())); fos.write("Hello World".getBytes()); // write operation
assertTrue(childFile.getPath().equals(parentDirectory.getPath() + separatorCharacter + "file1.txt")); fos.flush();
} catch (IOException e) {
removeDirectory(parentDirectory); writable = false;
} } finally {
removeDir(parentDir);
}
@Test(expected = FileNotFoundException.class) assertFalse(writable);
public void givenReadOnlyFileCreated_whenCreateNewFileInvoked_thenFileCannotBeWrittenTo() throws IOException {
File parentDirectory = makeDirectory("filesDirectory");
File childFile = new File(parentDirectory, "file1.txt");
childFile.createNewFile();
childFile.setWritable(false);
FileOutputStream fos = new FileOutputStream(childFile);
fos.write("Hello World".getBytes()); // write operation
fos.flush();
fos.close();
removeDirectory(parentDirectory);
}
@Test(expected = FileNotFoundException.class)
public void givenWriteOnlyFileCreated_whenCreateNewFileInvoked_thenFileCannotBeReadFrom() throws IOException {
File parentDirectory = makeDirectory("filesDirectory");
File childFile = new File(parentDirectory, "file1.txt");
childFile.createNewFile();
childFile.setReadable(false);
FileInputStream fis = new FileInputStream(childFile);
fis.read(); // read operation
fis.close();
removeDirectory(parentDirectory);
} }
@Test @Test
public void givenFilesCreatedInDirectory_whenCreateNewFileInvoked_thenTheyCanBeListedAsExpected() throws IOException { public void givenWriteOnlyFile_whenCreateNewFile_thenCantReadFile() {
File directory = makeDirectory("filtersDirectory"); File parentDir = makeDir("writeDir");
File csvFile = new File(directory, "csvFile.csv"); File child = new File(parentDir, "file.txt");
csvFile.createNewFile(); try {
child.createNewFile();
} catch (IOException e) {
fail("Could not create " + "file.txt");
}
child.setReadable(false);
boolean readable = true;
try (FileInputStream fis = new FileInputStream(child)) {
fis.read(); // read operation
} catch (IOException e) {
readable = false;
} finally {
removeDir(parentDir);
}
assertFalse(readable);
}
File txtFile = new File(directory, "txtFile.txt"); @Test
txtFile.createNewFile(); public void givenFilesInDir_whenCreateNewFile_thenCanListFiles() {
File parentDir = makeDir("filtersDir");
String[] files = {"file1.csv", "file2.txt"};
for (String file : files) {
try {
new File(parentDir, file).createNewFile();
} catch (IOException e) {
fail("Could not create " + file);
}
}
//normal listing //normal listing
assertEquals(2, directory.list().length); assertEquals(2, parentDir.list().length);
//filtered listing //filtered listing
FilenameFilter csvFilter = (dir, ext) -> ext.endsWith(".csv"); FilenameFilter csvFilter = (dir, ext) -> ext.endsWith(".csv");
assertEquals(1, directory.list(csvFilter).length); assertEquals(1, parentDir.list(csvFilter).length);
removeDirectory(directory); removeDir(parentDir);
} }
@Test @Test
public void givenDirectoryIsCreated_whenMkdirInvoked_thenDirectoryCanBeRenamed() { public void givenDir_whenMkdir_thenCanRenameDir() {
File source = makeDirectory("source"); File source = makeDir("source");
File destination = makeDirectory("destination"); File destination = makeDir("destination");
source.renameTo(destination); boolean renamed = source.renameTo(destination);
assertFalse(source.isDirectory()); if (renamed) {
assertTrue(destination.isDirectory()); assertFalse(source.isDirectory());
assertTrue(destination.isDirectory());
removeDirectory(destination); removeDir(destination);
}
} }
@Test @Test
public void givenDataIsWrittenToFile_whenWriteIsInvoked_thenFreeSpaceOnSystemDecreases() throws IOException { public void givenDataWritten_whenWrite_thenFreeSpaceReduces() {
String name = System.getProperty("user.home") + System.getProperty("file.separator") + "test"; String home = System.getProperty("user.home");
File testDir = makeDirectory(name); String sep = File.separator;
File testDir = makeDir(home + sep + "test");
File sample = new File(testDir, "sample.txt"); File sample = new File(testDir, "sample.txt");
long freeSpaceBeforeWrite = testDir.getFreeSpace(); long freeSpaceBefore = testDir.getFreeSpace();
writeSampleDataToFile(sample); try {
writeSampleDataToFile(sample);
} catch (IOException e) {
fail("Could not write to " + "sample.txt");
}
long freeSpaceAfterWrite = testDir.getFreeSpace(); long freeSpaceAfter = testDir.getFreeSpace();
assertTrue(freeSpaceAfterWrite < freeSpaceBeforeWrite); assertTrue(freeSpaceAfter < freeSpaceBefore);
removeDirectory(testDir); removeDir(testDir);
} }
private static File makeDirectory(String directoryName) { private static File makeDir(String name) {
File directory = new File(directoryName); File directory = new File(name);
directory.mkdir(); directory.mkdir();
if (directory.isDirectory()) { if (directory.isDirectory()) {
return directory; return directory;
} }
throw new RuntimeException("Directory not created for " + directoryName); throw new RuntimeException("'" + name + "' not made!");
} }
private static void removeDirectory(File directory) { private static void removeDir(File directory) {
// make sure you don't delete your home directory here // make sure you don't delete your home directory here
if (directory.getPath().equals(System.getProperty("user.home"))) { String home = System.getProperty("user.home");
if (directory.getPath().equals(home)) {
return; return;
} }
// remove directory and its files from system // remove directory and its files from system
if (directory != null && directory.exists()) { if (directory.exists()) {
// delete all files inside the directory // delete all files inside the directory
File[] filesInDirectory = directory.listFiles(); File[] dirFiles = directory.listFiles();
if (filesInDirectory != null) { if (dirFiles != null) {
List<File> files = Arrays.asList(filesInDirectory); List<File> files = Arrays.asList(dirFiles);
files.forEach(f -> deleteFile(f)); files.forEach(f -> deleteFile(f));
} }
@ -171,8 +194,8 @@ public class FileClassDemoUnitTest {
//write sample text to file //write sample text to file
try (FileOutputStream out = new FileOutputStream(sample)) { try (FileOutputStream out = new FileOutputStream(sample)) {
for (int i = 1; i <= 100000; i++) { for (int i = 1; i <= 100000; i++) {
String sampleText = "Sample line number " + i + "\n"; String text = "Sample line number " + i + "\n";
out.write(sampleText.getBytes()); out.write(text.getBytes());
} }
} }
} }

View File

@ -0,0 +1,5 @@
package com.baeldung.strictfpUsage;
public strictfp interface Circle {
double computeArea(double radius);
}

View File

@ -0,0 +1,12 @@
package com.baeldung.strictfpUsage;
public strictfp class ScientificCalculator {
public double sum(double value1, double value2) {
return value1 + value2;
}
public double diff(double value1, double value2) {
return value1 - value2;
}
}

View File

@ -0,0 +1,18 @@
package com.baeldung.strictfpUsage;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
public class ScientificCalculatorUnitTest {
@Test
public void whenMethodOfstrictfpClassInvoked_thenIdenticalResultOnAllPlatforms() {
ScientificCalculator calculator = new ScientificCalculator();
double result = calculator.sum(23e10, 98e17);
assertThat(result, is(9.800000230000001E18));
result = calculator.diff(Double.MAX_VALUE, 1.56);
assertThat(result, is(1.7976931348623157E308));
}
}

View File

@ -14,4 +14,4 @@ This module contains articles about core Java non-blocking input and output (IO)
- [Java NIO2 Path API](https://www.baeldung.com/java-nio-2-path) - [Java NIO2 Path API](https://www.baeldung.com/java-nio-2-path)
- [Guide to Java NIO2 Asynchronous Channel APIs](https://www.baeldung.com/java-nio-2-async-channels) - [Guide to Java NIO2 Asynchronous Channel APIs](https://www.baeldung.com/java-nio-2-async-channels)
- [A Guide to NIO2 Asynchronous Socket Channel](https://www.baeldung.com/java-nio2-async-socket-channel) - [A Guide to NIO2 Asynchronous Socket Channel](https://www.baeldung.com/java-nio2-async-socket-channel)
- [[More -->]](/core-java-modules/core-java-nio-2) - [[More -->]](/core-java-modules/core-java-nio-2)

View File

@ -0,0 +1,19 @@
package com.baeldung.streams.debug.entity;
public class Customer {
private final String name;
private final int age;
public Customer(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
}

View File

@ -0,0 +1,18 @@
package com.baeldung.streams.debug;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.stream.IntStream;
import org.junit.Test;
public class Example1 {
@Test
public void whenDebugging_thenInformationIsShown() {
int[] listOutputSorted = IntStream.of(-3, 10, -4, 1, 3)
.sorted()
.toArray();
assertThat(listOutputSorted).isSorted();
}
}

View File

@ -0,0 +1,36 @@
package com.baeldung.streams.debug;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import org.junit.Test;
import com.baeldung.streams.debug.entity.Customer;
public class Example2 {
@Test
public void whenDebugging_thenInformationIsShown() {
List<Optional<Customer>> customers = Arrays.asList(
Optional.of(new Customer("John P.", 15)),
Optional.of(new Customer("Sarah M.", 78)),
Optional.empty(),
Optional.of(new Customer("Mary T.", 20)),
Optional.empty(),
Optional.of(new Customer("Florian G.", 89)),
Optional.empty()
);
long numberOf65PlusCustomers = customers.stream()
.flatMap(c -> c.map(Stream::of)
.orElseGet(Stream::empty))
.mapToInt(Customer::getAge)
.filter(c -> c > 65)
.count();
assertThat(numberOf65PlusCustomers).isEqualTo(2);
}
}

View File

@ -12,5 +12,5 @@ This module contains articles about string-related algorithms.
- [Pad a String with Zeros or Spaces in Java](https://www.baeldung.com/java-pad-string) - [Pad a String with Zeros or Spaces in Java](https://www.baeldung.com/java-pad-string)
- [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters) - [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters)
- [Counting Words in a String](https://www.baeldung.com/java-word-counting) - [Counting Words in a String](https://www.baeldung.com/java-word-counting)
- [Finding the Difference Between Two Strings](https://www.baeldung.com/java-difference-between-two-strings) - [Finding the Difference Between Two Strings in Java](https://www.baeldung.com/java-difference-between-two-strings)
- More articles: [[<-- prev]](../core-java-string-algorithms) - More articles: [[<-- prev]](../core-java-string-algorithms)

View File

@ -2,7 +2,7 @@
This module contains articles about HttpClient 4.x This module contains articles about HttpClient 4.x
###The Course ### The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring The "REST With Spring" Classes: http://bit.ly/restwithspring

View File

@ -2,10 +2,12 @@
This module contains articles about Jackson. This module contains articles about Jackson.
###The Course ### The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles: ### Relevant Articles:
- [Jackson Unmarshall to Collection/Array](https://www.baeldung.com/jackson-collection-array) - [Jackson Unmarshall to Collection/Array](https://www.baeldung.com/jackson-collection-array)
- [Jackson Custom Serializer](https://www.baeldung.com/jackson-custom-serialization) - [Jackson Custom Serializer](https://www.baeldung.com/jackson-custom-serialization)
- [Getting Started with Custom Deserialization in Jackson](https://www.baeldung.com/jackson-deserialization) - [Getting Started with Custom Deserialization in Jackson](https://www.baeldung.com/jackson-deserialization)
@ -24,7 +26,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Map Serialization and Deserialization with Jackson](https://www.baeldung.com/jackson-map) - [Map Serialization and Deserialization with Jackson](https://www.baeldung.com/jackson-map)
- [Jackson Streaming API](https://www.baeldung.com/jackson-streaming-api) - [Jackson Streaming API](https://www.baeldung.com/jackson-streaming-api)
- [Jackson JsonMappingException (No serializer found for class)](https://www.baeldung.com/jackson-jsonmappingexception) - [Jackson JsonMappingException (No serializer found for class)](https://www.baeldung.com/jackson-jsonmappingexception)
- [How To Serialize Enums as JSON Objects with Jackson](https://www.baeldung.com/jackson-serialize-enums) - [How To Serialize and Deserialize Enums with Jackson](https://www.baeldung.com/jackson-serialize-enums)
- [Jackson Marshall String to JsonNode](https://www.baeldung.com/jackson-json-to-jsonnode) - [Jackson Marshall String to JsonNode](https://www.baeldung.com/jackson-json-to-jsonnode)
- [Jackson Unmarshall to Collection/Array](https://www.baeldung.com/jackson-collection-array) - [Jackson Unmarshall to Collection/Array](https://www.baeldung.com/jackson-collection-array)
- [Serialize Only Fields that meet a Custom Criteria with Jackson](https://www.baeldung.com/jackson-serialize-field-custom-criteria) - [Serialize Only Fields that meet a Custom Criteria with Jackson](https://www.baeldung.com/jackson-serialize-field-custom-criteria)

View File

@ -2,6 +2,6 @@
This module contains articles about JDI, the Java Debug Interface. This module contains articles about JDI, the Java Debug Interface.
###Relevant articles ### Relevant articles
- [An Intro to the Java Debug Interface (JDI)](https://www.baeldung.com/java-debug-interface) - [An Intro to the Java Debug Interface (JDI)](https://www.baeldung.com/java-debug-interface)

View File

@ -0,0 +1,14 @@
#!/bin/bash
while getopts u:a:f: flag
do
case "${flag}"
in
u) username=${OPTARG};;
a) age=${OPTARG};;
f) fullname=${OPTARG};;
esac
done
echo "Username: $username";
echo "Age: $age";
echo "Full Name: $fullname";

View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "Username: $1";
echo "Age: $2";
echo "Full Name: $3";

View File

@ -0,0 +1,8 @@
#!/bin/bash
i=1;
for user in "$@"
do
echo "Username - $i: $user";
i=$((i + 1));
done

View File

@ -0,0 +1,10 @@
#!/bin/bash
i=1;
j=$#;
while [ $i -le $j ]
do
echo "Username - $i: $1";
i=$((i + 1));
shift 1;
done

View File

@ -77,10 +77,11 @@
<properties> <properties>
<!-- lombok: https://projectlombok.org/changelog.html --> <!-- lombok: https://projectlombok.org/changelog.html -->
<lombok.version>1.18.10</lombok.version> <lombok.version>1.18.10</lombok.version>
<!-- various --> <!-- various -->
<hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version> <hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version>
<!-- delombok maven plugin --> <!-- delombok maven plugin -->
<delombok-maven-plugin.version>1.18.4.0</delombok-maven-plugin.version> <delombok-maven-plugin.version>1.18.10.0</delombok-maven-plugin.version>
<assertj-core.version>3.8.0</assertj-core.version> <assertj-core.version>3.8.0</assertj-core.version>
</properties> </properties>

View File

@ -3,8 +3,8 @@ package com.baeldung.lombok.accessors.model;
import java.math.BigDecimal; import java.math.BigDecimal;
public class BasicAccount { public class BasicAccount {
String name; private String name;
BigDecimal balance; private BigDecimal balance;
public BigDecimal getBalance() { public BigDecimal getBalance() {
return this.balance; return this.balance;

View File

@ -10,6 +10,6 @@ import java.math.BigDecimal;
@Getter @Getter
@Setter @Setter
public class ChainedAccount { public class ChainedAccount {
String name; private String name;
BigDecimal balance; private BigDecimal balance;
} }

View File

@ -10,6 +10,6 @@ import java.math.BigDecimal;
@Getter @Getter
@Setter @Setter
public class ChainedFluentAccount { public class ChainedFluentAccount {
String name; private String name;
BigDecimal balance; private BigDecimal balance;
} }

View File

@ -10,6 +10,6 @@ import java.math.BigDecimal;
@Getter @Getter
@Setter @Setter
public class FluentAccount { public class FluentAccount {
String name; private String name;
BigDecimal balance; private BigDecimal balance;
} }

View File

@ -11,6 +11,10 @@ import java.math.BigDecimal;
@Getter @Getter
@Setter @Setter
public class PrefixedAccount { public class PrefixedAccount {
String sName; private String sName;
BigDecimal bdBalance; private BigDecimal bdBalance;
@Accessors(prefix = "s_")
private String s_notes;
} }

View File

@ -10,6 +10,6 @@ import java.math.BigDecimal;
@Getter @Getter
@Setter @Setter
public class PrefixedFluentAccount { public class PrefixedFluentAccount {
String sName; private String sName;
BigDecimal bdBalance; private BigDecimal bdBalance;
} }

View File

@ -8,6 +8,6 @@ import java.math.BigDecimal;
@Getter @Getter
@Setter @Setter
public class StandardAccount { public class StandardAccount {
String name; private String name;
BigDecimal balance; private BigDecimal balance;
} }

View File

@ -12,11 +12,11 @@ public class AccessorsUnitTest {
@Test @Test
public void givenBasicAccount_thenUseBasicAccessors() { public void givenBasicAccount_thenUseBasicAccessors() {
BasicAccount account = new BasicAccount(); BasicAccount account = new BasicAccount();
account.setBalance(BigDecimal.TEN);
account.setName("Basic Accessors"); account.setName("Basic Accessors");
account.setBalance(BigDecimal.TEN);
assertEquals(BigDecimal.TEN, account.getBalance());
assertEquals("Basic Accessors", account.getName()); assertEquals("Basic Accessors", account.getName());
assertEquals(BigDecimal.TEN, account.getBalance());
} }
@Test @Test
@ -25,8 +25,8 @@ public class AccessorsUnitTest {
account.name("Fluent Account"); account.name("Fluent Account");
account.balance(BigDecimal.TEN); account.balance(BigDecimal.TEN);
assertEquals(BigDecimal.TEN, account.balance());
assertEquals("Fluent Account", account.name()); assertEquals("Fluent Account", account.name());
assertEquals(BigDecimal.TEN, account.balance());
} }
@Test @Test
@ -34,8 +34,8 @@ public class AccessorsUnitTest {
ChainedAccount account = new ChainedAccount(); ChainedAccount account = new ChainedAccount();
account.setName("Chained Account").setBalance(BigDecimal.TEN); account.setName("Chained Account").setBalance(BigDecimal.TEN);
assertEquals(BigDecimal.TEN, account.getBalance());
assertEquals("Chained Account", account.getName()); assertEquals("Chained Account", account.getName());
assertEquals(BigDecimal.TEN, account.getBalance());
} }
@Test @Test
@ -44,8 +44,8 @@ public class AccessorsUnitTest {
.name("Fluent Account") .name("Fluent Account")
.balance(BigDecimal.TEN); .balance(BigDecimal.TEN);
assertEquals(BigDecimal.TEN, account.balance());
assertEquals("Fluent Account", account.name()); assertEquals("Fluent Account", account.name());
assertEquals(BigDecimal.TEN, account.balance());
} }
@Test @Test
@ -53,9 +53,11 @@ public class AccessorsUnitTest {
PrefixedAccount account = new PrefixedAccount(); PrefixedAccount account = new PrefixedAccount();
account.setName("Prefixed Fields"); account.setName("Prefixed Fields");
account.setBalance(BigDecimal.TEN); account.setBalance(BigDecimal.TEN);
account.setNotes("Notes");
assertEquals(BigDecimal.TEN, account.getBalance());
assertEquals("Prefixed Fields", account.getName()); assertEquals("Prefixed Fields", account.getName());
assertEquals(BigDecimal.TEN, account.getBalance());
assertEquals("Notes", account.getNotes());
} }
@Test @Test
@ -65,8 +67,8 @@ public class AccessorsUnitTest {
.name("Prefixed Fluent Fields") .name("Prefixed Fluent Fields")
.balance(BigDecimal.TEN); .balance(BigDecimal.TEN);
assertEquals(BigDecimal.TEN, account.balance());
assertEquals("Prefixed Fluent Fields", account.name()); assertEquals("Prefixed Fluent Fields", account.name());
assertEquals(BigDecimal.TEN, account.balance());
} }
} }

View File

@ -2,7 +2,8 @@
This module contains articles about MapStruct. This module contains articles about MapStruct.
###Relevant Articles: ### Relevant Articles:
- [Quick Guide to MapStruct](https://www.baeldung.com/mapstruct) - [Quick Guide to MapStruct](https://www.baeldung.com/mapstruct)
- [Custom Mapper with MapStruct](https://www.baeldung.com/mapstruct-custom-mapper) - [Custom Mapper with MapStruct](https://www.baeldung.com/mapstruct-custom-mapper)
- [Using Multiple Source Objects with MapStruct](https://www.baeldung.com/mapstruct-multiple-source-objects) - [Using Multiple Source Objects with MapStruct](https://www.baeldung.com/mapstruct-multiple-source-objects)

View File

@ -0,0 +1,3 @@
### Relevant Articles:
- [Hibernate Error “Not all named parameters have been set”](https://www.baeldung.com/hibernate-error-named-parameters-not-set)

View File

@ -1,3 +1,3 @@
#Relevant Articles ### Relevant Articles
- [Spring Data with Reactive Cassandra](https://www.baeldung.com/spring-data-cassandra-reactive) - [Spring Data with Reactive Cassandra](https://www.baeldung.com/spring-data-cassandra-reactive)

View File

@ -0,0 +1,3 @@
### Relevant Articles:
- [Programmatic Transaction Management in Spring](https://www.baeldung.com/spring-programmatic-transaction-management)

View File

@ -610,7 +610,7 @@
<module>tensorflow-java</module> <module>tensorflow-java</module>
<module>spf4j</module> <module>spf4j</module>
<module>spring-boot-configuration</module> <module>spring-boot-config-jpa-error</module>
<module>spring-boot-flowable</module> <module>spring-boot-flowable</module>
<module>spring-boot-mvc-2</module> <module>spring-boot-mvc-2</module>
<module>spring-boot-performance</module> <module>spring-boot-performance</module>
@ -697,7 +697,7 @@
<module>spring-boot-bootstrap</module> <module>spring-boot-bootstrap</module>
<module>spring-boot-camel</module> <module>spring-boot-camel</module>
<!-- <module>spring-boot-cli</module> --> <!-- Not a maven project --> <!-- <module>spring-boot-cli</module> --> <!-- Not a maven project -->
<module>spring-boot-configuration</module> <module>spring-boot-config-jpa-error</module>
<module>spring-boot-client</module> <module>spring-boot-client</module>
<module>spring-boot-crud</module> <module>spring-boot-crud</module>

View File

@ -15,4 +15,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring ResponseStatusException](https://www.baeldung.com/spring-response-status-exception) - [Spring ResponseStatusException](https://www.baeldung.com/spring-response-status-exception)
- [Spring Assert Statements](https://www.baeldung.com/spring-assert) - [Spring Assert Statements](https://www.baeldung.com/spring-assert)
- [Configuring a Hikari Connection Pool with Spring Boot](https://www.baeldung.com/spring-boot-hikari) - [Configuring a Hikari Connection Pool with Spring Boot](https://www.baeldung.com/spring-boot-hikari)
- [Difference between <context:annotation-config> vs <context:component-scan>](https://www.baeldung.com/spring-contextannotation-contextcomponentscan) - [Difference between \<context:annotation-config> vs \<context:component-scan>](https://www.baeldung.com/spring-contextannotation-contextcomponentscan)

View File

@ -1,6 +1,6 @@
# Spring Boot Configuration # Spring Boot - DataJpaTest Error
This module contains articles about Spring Boot Configuration. This module contains examples about a corner case using @DataJpaTest with a multi module project.
### Relevant Articles: ### Relevant Articles:
- [Unable to Find @SpringBootConfiguration with @DataJpaTest](https://www.baeldung.com/spring-boot-unable-to-find-springbootconfiguration-with-datajpatest) - [Unable to Find @SpringBootConfiguration with @DataJpaTest](https://www.baeldung.com/spring-boot-unable-to-find-springbootconfiguration-with-datajpatest)

View File

@ -5,8 +5,8 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<parent> <parent>
<groupId>com.baeldung.spring-boot-configuration</groupId> <groupId>com.baeldung.spring-boot-config-jpa-error</groupId>
<artifactId>spring-boot-configuration</artifactId> <artifactId>spring-boot-config-jpa-error</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>
</project> </project>

View File

@ -5,8 +5,8 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<parent> <parent>
<groupId>com.baeldung.spring-boot-configuration</groupId> <groupId>com.baeldung.spring-boot-config-jpa-error</groupId>
<artifactId>spring-boot-configuration</artifactId> <artifactId>spring-boot-config-jpa-error</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>
</project> </project>

View File

@ -1,8 +1,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.spring-boot-configuration</groupId> <groupId>com.baeldung.spring-boot-config-jpa-error</groupId>
<artifactId>spring-boot-configuration</artifactId> <artifactId>spring-boot-config-jpa-error</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

@ -0,0 +1,3 @@
### Relevant Articles:
- [Documenting a Spring REST API Using OpenAPI 3.0](https://www.baeldung.com/spring-rest-openapi-documentation)

View File

@ -1,3 +1,3 @@
#Revelant Articles: # Relevant Articles:
- [Using a Spring Cloud App Starter](http://www.baeldung.com/spring-cloud-app-starter) - [Using a Spring Cloud App Starter](http://www.baeldung.com/spring-cloud-app-starter)

View File

@ -1,7 +1,7 @@
## Relevant Articles: ## Relevant Articles:
- [Understanding getBean() in Spring](https://www.baeldung.com/spring-getbean) - [Understanding getBean() in Spring](https://www.baeldung.com/spring-getbean)
- [Exploring the Spring BeanFactory API](https://www.baeldung.com/spring-beanfactory) - [Guide to the Spring BeanFactory](https://www.baeldung.com/spring-beanfactory)
- [How to use the Spring FactoryBean?](https://www.baeldung.com/spring-factorybean) - [How to use the Spring FactoryBean?](https://www.baeldung.com/spring-factorybean)
- [Spring Injecting Collections](https://www.baeldung.com/spring-injecting-collections) - [Spring Injecting Collections](https://www.baeldung.com/spring-injecting-collections)
- More articles: [[<-- prev]](/spring-core-2) - More articles: [[<-- prev]](/spring-core-2)

View File

@ -2,10 +2,12 @@
This module contains articles about Spring MVC with XML configuration This module contains articles about Spring MVC with XML configuration
###The Course ### The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles: ### Relevant Articles:
- [Java Session Timeout](https://www.baeldung.com/servlet-session-timeout) - [Java Session Timeout](https://www.baeldung.com/servlet-session-timeout)
- [Returning Image/Media Data with Spring MVC](https://www.baeldung.com/spring-mvc-image-media-data) - [Returning Image/Media Data with Spring MVC](https://www.baeldung.com/spring-mvc-image-media-data)
- [Geolocation by IP in Java](https://www.baeldung.com/geolocation-by-ip-with-maxmind) - [Geolocation by IP in Java](https://www.baeldung.com/geolocation-by-ip-with-maxmind)
@ -17,4 +19,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Debugging the Spring MVC 404 “No mapping found for HTTP request” Error](https://www.baeldung.com/spring-mvc-404-error) - [Debugging the Spring MVC 404 “No mapping found for HTTP request” Error](https://www.baeldung.com/spring-mvc-404-error)
## Spring MVC with XML Configuration Example Project ## Spring MVC with XML Configuration Example Project
- access a sample jsp page at: `http://localhost:8080/spring-mvc-xml/sample.html` - access a sample jsp page at: `http://localhost:8080/spring-mvc-xml/sample.html`

View File

@ -2,10 +2,12 @@
This module contains articles about Spring Security with custom MVC applications This module contains articles about Spring Security with custom MVC applications
###The Course ### The Course
The "REST With Spring" Classes: http://github.learnspringsecurity.com The "REST With Spring" Classes: http://github.learnspringsecurity.com
### Relevant Articles: ### Relevant Articles:
- [Spring Security Remember Me](https://www.baeldung.com/spring-security-remember-me) - [Spring Security Remember Me](https://www.baeldung.com/spring-security-remember-me)
- [Redirect to different pages after Login with Spring Security](https://www.baeldung.com/spring_redirect_after_login) - [Redirect to different pages after Login with Spring Security](https://www.baeldung.com/spring_redirect_after_login)
- [Changing Spring Model Parameters with Handler Interceptor](https://www.baeldung.com/spring-model-parameters-with-handler-interceptor) - [Changing Spring Model Parameters with Handler Interceptor](https://www.baeldung.com/spring-model-parameters-with-handler-interceptor)
@ -15,6 +17,7 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com
- [How to Manually Authenticate User with Spring Security](https://www.baeldung.com/manually-set-user-authentication-spring-security) - [How to Manually Authenticate User with Spring Security](https://www.baeldung.com/manually-set-user-authentication-spring-security)
### Build the Project ### Build the Project
``` ```
mvn clean install mvn clean install
``` ```

View File

@ -2,10 +2,12 @@
This module contains articles about digest authentication with Spring Security This module contains articles about digest authentication with Spring Security
###The Course ### The Course
The "Learn Spring Security" Classes: http://github.learnspringsecurity.com The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
### Relevant Article: ### Relevant Article:
- [Spring Security Digest Authentication](https://www.baeldung.com/spring-security-digest-authentication) - [Spring Security Digest Authentication](https://www.baeldung.com/spring-security-digest-authentication)
- [RestTemplate with Digest Authentication](https://www.baeldung.com/resttemplate-digest-authentication) - [RestTemplate with Digest Authentication](https://www.baeldung.com/resttemplate-digest-authentication)

View File

@ -2,14 +2,17 @@
This module contains articles about Spring Security LDAP This module contains articles about Spring Security LDAP
###The Course ### The Course
The "Learn Spring Security" Classes: http://github.learnspringsecurity.com The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
### Relevant Article: ### Relevant Article:
- [Spring Security security none, filters none, access permitAll](https://www.baeldung.com/security-none-filters-none-access-permitAll) - [Spring Security security none, filters none, access permitAll](https://www.baeldung.com/security-none-filters-none-access-permitAll)
- [Intro to Spring Security LDAP](https://www.baeldung.com/spring-security-ldap) - [Intro to Spring Security LDAP](https://www.baeldung.com/spring-security-ldap)
### Notes ### Notes
- the project uses Spring Boot - simply run 'SampleLDAPApplication.java' to start up Spring Boot with a Tomcat container and embedded LDAP server. - the project uses Spring Boot - simply run 'SampleLDAPApplication.java' to start up Spring Boot with a Tomcat container and embedded LDAP server.
- Once started, open 'http://localhost:8080' - Once started, open 'http://localhost:8080'
- This will display the publicly available Home Page - This will display the publicly available Home Page

View File

@ -2,13 +2,16 @@
This module contains articles about 'remember me' with Spring Security This module contains articles about 'remember me' with Spring Security
###The Course ### The Course
The "Learn Spring Security" Classes: http://github.learnspringsecurity.com The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
### Relevant Articles: ### Relevant Articles:
- [Spring Security Persistent Remember Me](https://www.baeldung.com/spring-security-persistent-remember-me) - [Spring Security Persistent Remember Me](https://www.baeldung.com/spring-security-persistent-remember-me)
### Build the Project ### Build the Project
``` ```
mvn clean install mvn clean install
``` ```

View File

@ -2,15 +2,18 @@
This module contains articles about Spring Security in MVC applications This module contains articles about Spring Security in MVC applications
###The Course ### The Course
The "Learn Spring Security" Classes: http://github.learnspringsecurity.com The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
### Relevant Articles: ### Relevant Articles:
- [HttpSessionListener Example Monitoring](https://www.baeldung.com/httpsessionlistener_with_metrics) - [HttpSessionListener Example Monitoring](https://www.baeldung.com/httpsessionlistener_with_metrics)
- [Control the Session with Spring Security](https://www.baeldung.com/spring-security-session) - [Control the Session with Spring Security](https://www.baeldung.com/spring-security-session)
### Build the Project ### Build the Project
``` ```
mvn clean install mvn clean install
``` ```

View File

@ -2,11 +2,12 @@
This module contains articles about basic authentication in RESTful APIs with Spring Security This module contains articles about basic authentication in RESTful APIs with Spring Security
###The Course ### The Course
The "Learn Spring Security" Classes: http://github.learnspringsecurity.com The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
### Relevant Articles: ### Relevant Articles:
- [Basic Authentication with the RestTemplate](https://www.baeldung.com/how-to-use-resttemplate-with-basic-authentication-in-spring) - [Basic Authentication with the RestTemplate](https://www.baeldung.com/how-to-use-resttemplate-with-basic-authentication-in-spring)
- [A Custom Filter in the Spring Security Filter Chain](https://www.baeldung.com/spring-security-custom-filter) - [A Custom Filter in the Spring Security Filter Chain](https://www.baeldung.com/spring-security-custom-filter)
- [Spring Security Basic Authentication](https://www.baeldung.com/spring-security-basic-authentication) - [Spring Security Basic Authentication](https://www.baeldung.com/spring-security-basic-authentication)

View File

@ -2,10 +2,12 @@
This module contains articles about REST APIs with Spring Security This module contains articles about REST APIs with Spring Security
###The Course ### The Course
The "REST With Spring" Classes: http://github.learnspringsecurity.com The "REST With Spring" Classes: http://github.learnspringsecurity.com
### Relevant Articles: ### Relevant Articles:
- [Spring Security Authentication Provider](https://www.baeldung.com/spring-security-authentication-provider) - [Spring Security Authentication Provider](https://www.baeldung.com/spring-security-authentication-provider)
- [Retrieve User Information in Spring Security](https://www.baeldung.com/get-user-in-spring-security) - [Retrieve User Information in Spring Security](https://www.baeldung.com/get-user-in-spring-security)
- [Spring Security Run-As Authentication](https://www.baeldung.com/spring-security-run-as-auth) - [Spring Security Run-As Authentication](https://www.baeldung.com/spring-security-run-as-auth)

View File

@ -1,4 +1,5 @@
###Relevant Articles: ### Relevant Articles:
- [A Guide to REST-assured](http://www.baeldung.com/rest-assured-tutorial) - [A Guide to REST-assured](http://www.baeldung.com/rest-assured-tutorial)
- [REST-assured Support for Spring MockMvc](https://www.baeldung.com/spring-mock-mvc-rest-assured) - [REST-assured Support for Spring MockMvc](https://www.baeldung.com/spring-mock-mvc-rest-assured)
- [Getting and Verifying Response Data with REST-assured](https://www.baeldung.com/rest-assured-response) - [Getting and Verifying Response Data with REST-assured](https://www.baeldung.com/rest-assured-response)

View File

@ -2,10 +2,12 @@
## REST Testing and Examples ## REST Testing and Examples
###The Course ### The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles: ### Relevant Articles:
- [Introduction to WireMock](http://www.baeldung.com/introduction-to-wiremock) - [Introduction to WireMock](http://www.baeldung.com/introduction-to-wiremock)
- [Using WireMock Scenarios](https://www.baeldung.com/wiremock-scenarios) - [Using WireMock Scenarios](https://www.baeldung.com/wiremock-scenarios)
- [REST API Testing with Cucumber](http://www.baeldung.com/cucumber-rest-api-testing) - [REST API Testing with Cucumber](http://www.baeldung.com/cucumber-rest-api-testing)

View File

@ -1,2 +1,3 @@
###Relevant Articles: ### Relevant Articles:
- [Introduction To XMLUnit 2.x](http://www.baeldung.com/xmlunit2) - [Introduction To XMLUnit 2.x](http://www.baeldung.com/xmlunit2)