Merge branch 'master' into sla-pr/1381-vert.x-dhrubayotti
This commit is contained in:
commit
c071c59ada
13
.travis.yml
13
.travis.yml
|
@ -1,6 +1,9 @@
|
||||||
language: java
|
language: java
|
||||||
|
|
||||||
install: travis_wait 40 mvn -q clean install -Dgib.enabled=true
|
install: travis_wait 60 mvn -q clean install
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- echo "MAVEN_OPTS='-Xmx2048M -Xss128M -XX:MaxPermSize=2048M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-UseGCOverheadLimit'" > ~/.mavenrc
|
||||||
|
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk8
|
||||||
|
@ -14,10 +17,4 @@ cache:
|
||||||
directories:
|
directories:
|
||||||
- .autoconf
|
- .autoconf
|
||||||
- $HOME/.m2
|
- $HOME/.m2
|
||||||
|
|
||||||
sudo: required
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
JAVA_OPTS="-Xmx2048M -Xss128M -XX:MaxPermSize=2048M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"
|
|
||||||
MAVEN_OPTS="-Xmx2048M -Xss128M -XX:MaxPermSize=2048M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ public final class RtState implements State {
|
||||||
}
|
}
|
||||||
|
|
||||||
public State transit(final CharSequence c) {
|
public State transit(final CharSequence c) {
|
||||||
for(final Transition t : this.transitions) {
|
return transitions
|
||||||
if(t.isPossible(c)) {
|
.stream()
|
||||||
return t.state();
|
.filter(t -> t.isPossible(c))
|
||||||
}
|
.map(Transition::state)
|
||||||
}
|
.findAny()
|
||||||
throw new IllegalArgumentException("Input not accepted: " + c);
|
.orElseThrow(() -> new IllegalArgumentException("Input not accepted: " + c));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFinal() {
|
public boolean isFinal() {
|
||||||
|
|
Binary file not shown.
|
@ -250,6 +250,7 @@
|
||||||
<goal>single</goal>
|
<goal>single</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
|
||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||||
|
|
|
@ -145,6 +145,7 @@
|
||||||
<goal>single</goal>
|
<goal>single</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
|
||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
## Relevant articles:
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.baeldung.guava</groupId>
|
||||||
|
<artifactId>tutorial</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>21.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.11</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.baeldung.guava.tutorial;
|
||||||
|
|
||||||
|
import com.google.common.collect.Comparators;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ComparatorsExamples {
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
|
||||||
|
List<Integer> integers = Arrays.asList(1,2,3,4,4,6,7,8,9,10);
|
||||||
|
//This will return true
|
||||||
|
boolean isInAscendingOrder = Comparators.isInOrder(integers, new AscedingOrderComparator());
|
||||||
|
|
||||||
|
System.out.println(isInAscendingOrder);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class AscedingOrderComparator implements Comparator<Integer> {
|
||||||
|
@Override
|
||||||
|
public int compare(Integer o1, Integer o2) {
|
||||||
|
return o1.compareTo(o2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.baeldung.guava.tutorial;
|
||||||
|
|
||||||
|
import com.google.common.collect.Streams;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class ConcatStreams {
|
||||||
|
public static Stream concatStreams(Stream stream1, Stream stream2, Stream stream3){
|
||||||
|
return Streams.concat(stream1,stream2,stream3);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.baeldung.guava.tutorial;
|
||||||
|
|
||||||
|
import com.google.common.collect.Interner;
|
||||||
|
import com.google.common.collect.Interners;
|
||||||
|
|
||||||
|
import static com.google.common.collect.Interners.newBuilder;
|
||||||
|
|
||||||
|
public class InternerBuilderExample {
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
Interner<Integer> interners = Interners.<Integer>newBuilder()
|
||||||
|
.concurrencyLevel(2)
|
||||||
|
.strong()
|
||||||
|
.<Integer>build();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.baeldung.guava.tutorial;
|
||||||
|
|
||||||
|
import com.google.common.collect.MoreCollectors;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class MoreCollectorsExample {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
List<Integer> numbers = Arrays.asList(1);
|
||||||
|
Optional<Integer> number = numbers.stream()
|
||||||
|
.map(e -> e * 2)
|
||||||
|
.collect(MoreCollectors.toOptional());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.baeldung.guava.tutorial;
|
||||||
|
|
||||||
|
import com.google.common.collect.Streams;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.DoubleStream;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import java.util.stream.LongStream;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class StreamsUtility {
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
|
||||||
|
List<Integer> numbers = Arrays.asList(1,2,3,4,5,6,7,8,9,10,11,11,12,13,14,15,16,17,18,19,20);
|
||||||
|
//Using Collection
|
||||||
|
Stream<Integer> streamFromCollection = Streams.stream(numbers);
|
||||||
|
//Using Iterator
|
||||||
|
Stream<Integer> streamFromIterator = Streams.stream(numbers.iterator());
|
||||||
|
//Using Iterable
|
||||||
|
Stream<Integer> streamFromIterable = Streams.stream((Iterable<Integer>) numbers);
|
||||||
|
//Using Optional
|
||||||
|
Stream<Integer> streamFromOptional = Streams.stream(Optional.of(1));
|
||||||
|
//Using OptionalLong to LongStream
|
||||||
|
LongStream streamFromOptionalLong = Streams.stream(OptionalLong.of(1));
|
||||||
|
//Using OptionalInt to IntStream
|
||||||
|
IntStream streamFromOptionalInt = Streams.stream(OptionalInt.of(1));
|
||||||
|
//Using OptionalDouble to DoubleStream
|
||||||
|
DoubleStream streamFromOptionalDouble = Streams.stream(OptionalDouble.of(1.0));
|
||||||
|
|
||||||
|
Stream<Integer> concatenatedStreams = Streams.concat(streamFromCollection,streamFromIterable,streamFromIterator);
|
||||||
|
|
||||||
|
List<Integer> integers = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
|
||||||
|
//This will return 10
|
||||||
|
Optional<Integer> lastItem = Streams.findLast(integers.stream());
|
||||||
|
|
||||||
|
Streams.zip(
|
||||||
|
Stream.of("candy", "chocolate", "bar"),
|
||||||
|
Stream.of("$1", "$2","$3"),
|
||||||
|
(arg1, arg2) -> arg1 + ":" + arg2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
import com.google.common.collect.Comparators;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.ToDoubleFunction;
|
||||||
|
import java.util.function.ToIntFunction;
|
||||||
|
import java.util.function.ToLongFunction;
|
||||||
|
|
||||||
|
public class ComparatorsUnitTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isInOrderTest(){
|
||||||
|
|
||||||
|
List<Integer> numbers = Arrays.asList(1,2,3,4,4,6,7,8,9,10);
|
||||||
|
|
||||||
|
boolean isInAscendingOrder = Comparators.isInOrder(numbers, new AscendingOrderComparator<Number>());
|
||||||
|
|
||||||
|
Assert.assertTrue(isInAscendingOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isInStrictOrderTest(){
|
||||||
|
|
||||||
|
List<Integer> numbers = Arrays.asList(1,2,3,4,3,6,7,8,9,10);
|
||||||
|
|
||||||
|
boolean isInAscendingOrder = Comparators.isInOrder(numbers, new AscendingOrderComparator<Number>());
|
||||||
|
|
||||||
|
Assert.assertFalse(isInAscendingOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class AscendingOrderComparator<I extends Number> implements Comparator<Integer>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Integer o1, Integer o2) {
|
||||||
|
return o1.compareTo(o2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Comparator<Integer> reversed() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Comparator<Integer> thenComparing(Comparator<? super Integer> other) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <U> Comparator<Integer> thenComparing(Function<? super Integer, ? extends U> keyExtractor, Comparator<? super U> keyComparator) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <U extends Comparable<? super U>> Comparator<Integer> thenComparing(Function<? super Integer, ? extends U> keyExtractor) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Comparator<Integer> thenComparingInt(ToIntFunction<? super Integer> keyExtractor) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Comparator<Integer> thenComparingLong(ToLongFunction<? super Integer> keyExtractor) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Comparator<Integer> thenComparingDouble(ToDoubleFunction<? super Integer> keyExtractor) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,155 @@
|
||||||
|
import com.google.common.collect.Streams;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.DoubleStream;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import java.util.stream.LongStream;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class GauavaStreamsTests {
|
||||||
|
|
||||||
|
List<Integer> numbers;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp(){
|
||||||
|
numbers = Arrays.asList(1,2,3,4,5,6,7,8,9,10,11,11,12,13,14,15,16,17,18,19,20);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createStreamsWithCollection(){
|
||||||
|
//Deprecated API to create stream from collection
|
||||||
|
Stream streamFromCollection = Streams.stream(numbers);
|
||||||
|
|
||||||
|
//Assert.assertNotNull(streamFromCollection);
|
||||||
|
StreamUtility.assertStreamEquals(streamFromCollection, numbers.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createStreamsWithIterable(){
|
||||||
|
Iterable<Integer> numbersIterable = (Iterable<Integer>) numbers;
|
||||||
|
|
||||||
|
Stream streamFromIterable = Streams.stream(numbersIterable);
|
||||||
|
|
||||||
|
Assert.assertNotNull(streamFromIterable);
|
||||||
|
StreamUtility.assertStreamEquals(streamFromIterable, numbers.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createStreamsWithIterator(){
|
||||||
|
Iterator<Integer> numbersIterator = numbers.iterator();
|
||||||
|
|
||||||
|
Stream streamFromIterator = Streams.stream(numbersIterator);
|
||||||
|
|
||||||
|
Assert.assertNotNull(streamFromIterator);
|
||||||
|
StreamUtility.assertStreamEquals(streamFromIterator, numbers.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createStreamsWithOptional(){
|
||||||
|
|
||||||
|
Stream streamFromOptional = Streams.stream(Optional.of(1));
|
||||||
|
|
||||||
|
Assert.assertNotNull(streamFromOptional);
|
||||||
|
Assert.assertEquals(streamFromOptional.count(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createStreamsWithOptionalLong(){
|
||||||
|
|
||||||
|
LongStream streamFromOptionalLong = Streams.stream(OptionalLong.of(1));
|
||||||
|
|
||||||
|
Assert.assertNotNull(streamFromOptionalLong);
|
||||||
|
Assert.assertEquals(streamFromOptionalLong.count(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createStreamsWithOptionalInt(){
|
||||||
|
|
||||||
|
IntStream streamFromOptionalInt = Streams.stream(OptionalInt.of(1));
|
||||||
|
|
||||||
|
//Assert.assertNotNull(streamFromOptionalInt);
|
||||||
|
Assert.assertEquals(streamFromOptionalInt.count(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createStreamsWithOptionalDouble(){
|
||||||
|
|
||||||
|
DoubleStream streamFromOptionalDouble = Streams.stream(OptionalDouble.of(1.0));
|
||||||
|
|
||||||
|
//Assert.assertNotNull(streamFromOptionalDouble);
|
||||||
|
Assert.assertEquals(streamFromOptionalDouble.count(), 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void concatStreamsOfSameType(){
|
||||||
|
Stream oddNumbers = Arrays.asList(1,3,5,7,9,11,13,15,17,19).stream();
|
||||||
|
Stream evenNumbers = Arrays.asList(2,4,6,8,10,12,14,16,18,20).stream();
|
||||||
|
|
||||||
|
Stream combinedStreams = Streams.concat(oddNumbers,evenNumbers);
|
||||||
|
|
||||||
|
//Assert.assertNotNull(combinedStreams);
|
||||||
|
StreamUtility.assertStreamEquals(combinedStreams, Stream.concat(oddNumbers, evenNumbers));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void concatStreamsOfTypeLongStream(){
|
||||||
|
LongStream firstTwenty = LongStream.range(1,20);
|
||||||
|
LongStream nextTwenty = LongStream.range(21,40);
|
||||||
|
|
||||||
|
LongStream combinedStreams = Streams.concat(firstTwenty,nextTwenty);
|
||||||
|
|
||||||
|
Assert.assertNotNull(combinedStreams);
|
||||||
|
StreamUtility.assertStreamEquals(combinedStreams, LongStream.concat(firstTwenty, nextTwenty));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void concatStreamsOfTypeIntStream(){
|
||||||
|
IntStream firstTwenty = IntStream.range(1,20);
|
||||||
|
IntStream nextTwenty = IntStream.range(21,40);
|
||||||
|
|
||||||
|
IntStream combinedStreams = Streams.concat(firstTwenty,nextTwenty);
|
||||||
|
|
||||||
|
Assert.assertNotNull(combinedStreams);
|
||||||
|
StreamUtility.assertStreamEquals(combinedStreams, IntStream.concat(firstTwenty, nextTwenty));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void findLastOfStream(){
|
||||||
|
Optional<Integer> lastElement = Streams.findLast(numbers.stream());
|
||||||
|
|
||||||
|
Assert.assertNotNull(lastElement.get());
|
||||||
|
Assert.assertEquals(lastElement.get(), numbers.get(20));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void mapWithIndexTest(){
|
||||||
|
Stream stringSream = Stream.of("a","b","c");
|
||||||
|
|
||||||
|
Stream<String> mappedStream = Streams.mapWithIndex(stringSream,(str,index) -> str +":"+ index);
|
||||||
|
|
||||||
|
//Assert.assertNotNull(mappedStream);
|
||||||
|
Assert.assertEquals(mappedStream.findFirst().get(), "a:0");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void streamsZipTest(){
|
||||||
|
Stream stringSream = Stream.of("a","b","c");
|
||||||
|
Stream intStream = Stream.of(1,2,3);
|
||||||
|
Stream<String> mappedStream = Streams.zip(stringSream,intStream, (str,index) -> str +":"+ index);
|
||||||
|
|
||||||
|
//Assert.assertNotNull(mappedStream);
|
||||||
|
Assert.assertEquals(mappedStream.findFirst().get(), "a:1");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
import com.google.common.collect.Interner;
|
||||||
|
import com.google.common.collect.Interners;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class InternBuilderUnitTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void interBuilderTest(){
|
||||||
|
|
||||||
|
Interner<Integer> interners = Interners.<Integer>newBuilder()
|
||||||
|
.concurrencyLevel(2)
|
||||||
|
.strong()
|
||||||
|
.<Integer>build();
|
||||||
|
|
||||||
|
Assert.assertNotNull(interners);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
import com.google.common.collect.MoreCollectors;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class MoreCollectorsUnitTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void toOptionalTest(){
|
||||||
|
|
||||||
|
List<Integer> numbers = Arrays.asList(1);
|
||||||
|
|
||||||
|
Optional<Integer> number = numbers.stream()
|
||||||
|
.map( e -> e*2)
|
||||||
|
.collect(MoreCollectors.toOptional());
|
||||||
|
|
||||||
|
Assert.assertEquals(number.get(),new Integer(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onlyElementTest(){
|
||||||
|
List<Integer> numbers = Arrays.asList(1);
|
||||||
|
|
||||||
|
Integer number = numbers.stream()
|
||||||
|
.map( e -> e*2)
|
||||||
|
.collect(MoreCollectors.onlyElement());
|
||||||
|
|
||||||
|
Assert.assertEquals(number,new Integer(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
import org.junit.Assert;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.stream.DoubleStream;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import java.util.stream.LongStream;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class StreamUtility {
|
||||||
|
|
||||||
|
public static <T> boolean assertStreamEquals(Stream<T> stream1, Stream<T> stream2){
|
||||||
|
|
||||||
|
Iterator<T> iterator1 = stream1.iterator();
|
||||||
|
Iterator<T> iterator2 = stream2.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()){
|
||||||
|
Assert.assertEquals(iterator1.next(), iterator2.next());
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.assertFalse(iterator2.hasNext());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean assertStreamEquals(LongStream stream1, LongStream stream2) {
|
||||||
|
|
||||||
|
Iterator iterator1 = stream1.iterator();
|
||||||
|
Iterator iterator2 = stream2.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()){
|
||||||
|
Assert.assertEquals(iterator1.next(), iterator2.next());
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.assertFalse(iterator2.hasNext());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean assertStreamEquals(DoubleStream stream1, DoubleStream stream2) {
|
||||||
|
|
||||||
|
Iterator iterator1 = stream1.iterator();
|
||||||
|
Iterator iterator2 = stream2.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()){
|
||||||
|
Assert.assertEquals(iterator1.next(), iterator2.next());
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.assertFalse(iterator2.hasNext());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean assertStreamEquals(IntStream stream1, IntStream stream2) {
|
||||||
|
|
||||||
|
Iterator iterator1 = stream1.iterator();
|
||||||
|
Iterator iterator2 = stream2.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()){
|
||||||
|
Assert.assertEquals(iterator1.next(), iterator2.next());
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.assertFalse(iterator2.hasNext());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,8 +22,17 @@
|
||||||
<artifactId>javaslang</artifactId>
|
<artifactId>javaslang</artifactId>
|
||||||
<version>2.1.0-alpha</version>
|
<version>2.1.0-alpha</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.javaslang</groupId>
|
||||||
|
<artifactId>javaslang-test</artifactId>
|
||||||
|
<version>${javaslang.test.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<javaslang.test.version>2.0.5</javaslang.test.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.baeldung.javaslang;
|
||||||
|
|
||||||
|
|
||||||
|
import javaslang.CheckedFunction1;
|
||||||
|
import javaslang.collection.Stream;
|
||||||
|
import javaslang.test.Arbitrary;
|
||||||
|
import javaslang.test.CheckResult;
|
||||||
|
import javaslang.test.Property;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class PropertyBasedTest {
|
||||||
|
|
||||||
|
public Stream<String> stringsSupplier() {
|
||||||
|
return Stream.from(0).map(i -> {
|
||||||
|
boolean divByTwo = i % 2 == 0;
|
||||||
|
boolean divByFive = i % 5 == 0;
|
||||||
|
|
||||||
|
if(divByFive && divByTwo){
|
||||||
|
return "DividedByTwoAndFiveWithoutRemainder";
|
||||||
|
}else if(divByFive){
|
||||||
|
return "DividedByFiveWithoutRemainder";
|
||||||
|
}else if(divByTwo){
|
||||||
|
return "DividedByTwoWithoutRemainder";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenArbitrarySeq_whenCheckThatEverySecondElementIsEqualToString_thenTestPass() {
|
||||||
|
//given
|
||||||
|
Arbitrary<Integer> multiplesOf2 = Arbitrary.integer()
|
||||||
|
.filter(i -> i > 0)
|
||||||
|
.filter(i -> i % 2 == 0 && i % 5 != 0);
|
||||||
|
|
||||||
|
//when
|
||||||
|
CheckedFunction1<Integer, Boolean> mustEquals =
|
||||||
|
i -> stringsSupplier().get(i).equals("DividedByTwoWithoutRemainder");
|
||||||
|
|
||||||
|
|
||||||
|
//then
|
||||||
|
CheckResult result = Property
|
||||||
|
.def("Every second element must equal to DividedByTwoWithoutRemainder")
|
||||||
|
.forAll(multiplesOf2)
|
||||||
|
.suchThat(mustEquals)
|
||||||
|
.check(10_000, 100);
|
||||||
|
|
||||||
|
result.assertIsSatisfied();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenArbitrarySeq_whenCheckThatEveryFifthElementIsEqualToString_thenTestPass() {
|
||||||
|
//given
|
||||||
|
Arbitrary<Integer> multiplesOf5 = Arbitrary.integer()
|
||||||
|
.filter(i -> i > 0)
|
||||||
|
.filter(i -> i % 5 == 0 && i % 2 == 0);
|
||||||
|
|
||||||
|
//when
|
||||||
|
CheckedFunction1<Integer, Boolean> mustEquals = i ->
|
||||||
|
stringsSupplier().get(i).endsWith("DividedByTwoAndFiveWithoutRemainder");
|
||||||
|
|
||||||
|
//then
|
||||||
|
Property.def("Every fifth element must equal to DividedByTwoAndFiveWithoutRemainder")
|
||||||
|
.forAll(multiplesOf5)
|
||||||
|
.suchThat(mustEquals)
|
||||||
|
.check(10_000, 1_000)
|
||||||
|
.assertIsSatisfied();
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,6 +30,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
|
||||||
<!--archive> <manifest> <mainClass>fully.qualified.MainClass</mainClass> </manifest> </archive -->
|
<!--archive> <manifest> <mainClass>fully.qualified.MainClass</mainClass> </manifest> </archive -->
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
|
16
pom.xml
16
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<gib.referenceBranch>refs/heads/master</gib.referenceBranch>
|
<gib.referenceBranch>refs/heads/master</gib.referenceBranch>
|
||||||
<gib.enabled>false</gib.enabled>
|
<!-- <gib.enabled>false</gib.enabled>-->
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@ -210,6 +210,18 @@
|
||||||
<module>vertx</module>
|
<module>vertx</module>
|
||||||
</modules>
|
</modules>
|
||||||
<build>
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>1.6.0</version>
|
||||||
|
<configuration>
|
||||||
|
<executable>maven</executable>
|
||||||
|
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
<extensions>
|
<extensions>
|
||||||
<!--<extension>
|
<!--<extension>
|
||||||
<groupId>com.vackosar.gitflowincrementalbuilder</groupId>
|
<groupId>com.vackosar.gitflowincrementalbuilder</groupId>
|
||||||
|
@ -218,4 +230,4 @@
|
||||||
</extension>-->
|
</extension>-->
|
||||||
</extensions>
|
</extensions>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
## Spring REST Example Project
|
## Spring REST Example Project
|
||||||
|
|
||||||
###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
|
||||||
|
|
||||||
|
- [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests)
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
### Relevant articles
|
|
||||||
|
|
||||||
- [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests)
|
|
|
@ -14,4 +14,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
||||||
- [How to Register a Servlet in a Java Web Application](http://www.baeldung.com/register-servlet)
|
- [How to Register a Servlet in a Java Web Application](http://www.baeldung.com/register-servlet)
|
||||||
- [Guide to Spring WebUtils and ServletRequestUtils](http://www.baeldung.com/spring-webutils-servletrequestutils)
|
- [Guide to Spring WebUtils and ServletRequestUtils](http://www.baeldung.com/spring-webutils-servletrequestutils)
|
||||||
- [Using Custom Banners in Spring Boot](http://www.baeldung.com/spring-boot-custom-banners)
|
- [Using Custom Banners in Spring Boot](http://www.baeldung.com/spring-boot-custom-banners)
|
||||||
|
- [Guide to Internationalization in Spring Boot](http://www.baeldung.com/spring-boot-internationalization)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>spring-custom-aop</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>spring-custom-aop</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>1.5.2.RELEASE</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class Application {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(Application.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class ExampleAspect {
|
||||||
|
|
||||||
|
@Around("@annotation(LogExecutionTime)")
|
||||||
|
public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||||
|
final long start = System.currentTimeMillis();
|
||||||
|
|
||||||
|
final Object proceed = joinPoint.proceed();
|
||||||
|
|
||||||
|
final long executionTime = System.currentTimeMillis() - start;
|
||||||
|
|
||||||
|
System.out.println(joinPoint.getSignature() + " executed in " + executionTime + "ms");
|
||||||
|
|
||||||
|
return proceed;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface LogExecutionTime {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class Service {
|
||||||
|
|
||||||
|
@LogExecutionTime
|
||||||
|
public void serve() throws InterruptedException {
|
||||||
|
Thread.sleep(2000);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class CustomAnnotationTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Service service;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldApplyCustomAnnotation() throws InterruptedException {
|
||||||
|
service.serve();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
|
## Spring LDAP Example Project
|
||||||
|
|
||||||
### Relevant articles
|
### Relevant articles
|
||||||
|
|
||||||
- [Spring LDAP Overview](http://www.baeldung.com/spring-ldap)
|
- [Spring LDAP Overview](http://www.baeldung.com/spring-ldap)
|
||||||
|
- [Spring LDAP Example Project](http://www.baeldung.com/spring-ldap-overview/)
|
||||||
|
|
||||||
|
|
||||||
## Spring LDAP Example Project
|
|
||||||
- (http://www.baeldung.com/spring-ldap-overview/)
|
|
||||||
|
|
||||||
|
|
|
@ -1,48 +1,44 @@
|
||||||
package com.baeldung.springmvcforms.controller;
|
package com.baeldung.springmvcforms.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.baeldung.springmvcforms.domain.User;
|
||||||
import java.util.Collections;
|
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.validation.ObjectError;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import com.baeldung.springmvcforms.domain.User;
|
import javax.validation.Valid;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
List<User> users = new ArrayList<User>() {
|
private List<User> users = Arrays.asList(
|
||||||
{
|
new User("ana@yahoo.com", "pass", "Ana", 20),
|
||||||
add(new User("ana@yahoo.com", "pass", "Ana", 20));
|
new User("bob@yahoo.com", "pass", "Bob", 30),
|
||||||
add(new User("bob@yahoo.com", "pass", "Bob", 30));
|
new User("john@yahoo.com", "pass", "John", 40),
|
||||||
add(new User("john@yahoo.com", "pass", "John", 40));
|
new User("mary@yahoo.com", "pass", "Mary", 30));
|
||||||
add(new User("mary@yahoo.com", "pass", "Mary", 30));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@GetMapping("/userPage")
|
@GetMapping("/userPage")
|
||||||
public String getUserProfilePage() {
|
public String getUserProfilePage() {
|
||||||
return "user";
|
return "user";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/user", produces = MediaType.APPLICATION_JSON_VALUE)
|
@PostMapping("/user")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity<Object> saveUser(@Valid User user, BindingResult result, Model model) {
|
public ResponseEntity<Object> saveUser(@Valid User user, BindingResult result, Model model) {
|
||||||
if (result.hasErrors()) {
|
if (result.hasErrors()) {
|
||||||
List<String> errors = new ArrayList<>();
|
final List<String> errors = result.getAllErrors().stream()
|
||||||
result.getAllErrors().forEach(item->{
|
.map(DefaultMessageSourceResolvable::getDefaultMessage)
|
||||||
errors.add(item.getDefaultMessage());
|
.collect(Collectors.toList());
|
||||||
});
|
|
||||||
return new ResponseEntity<>(errors, HttpStatus.OK);
|
return new ResponseEntity<>(errors, HttpStatus.OK);
|
||||||
} else {
|
} else {
|
||||||
if (users.stream().anyMatch(it -> user.getEmail().equals(it.getEmail()))) {
|
if (users.stream().anyMatch(it -> user.getEmail().equals(it.getEmail()))) {
|
||||||
|
@ -54,7 +50,7 @@ public class UserController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping("/users")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<User> getUsers() {
|
public List<User> getUsers() {
|
||||||
return users;
|
return users;
|
||||||
|
|
|
@ -11,6 +11,7 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
|
||||||
- [Spring Security Expressions – hasRole Example](http://www.baeldung.com/spring-security-expressions-basic)
|
- [Spring Security Expressions – hasRole Example](http://www.baeldung.com/spring-security-expressions-basic)
|
||||||
- [Spring HTTP/HTTPS Channel Security](http://www.baeldung.com/spring-channel-security-https)
|
- [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 - 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)
|
||||||
|
|
||||||
### Build the Project
|
### Build the Project
|
||||||
```
|
```
|
||||||
|
|
|
@ -279,6 +279,7 @@
|
||||||
is org.apache.maven.plugins ...which is assumed by default. -->
|
is org.apache.maven.plugins ...which is assumed by default. -->
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
<descriptorRef>
|
<descriptorRef>
|
||||||
jar-with-dependencies
|
jar-with-dependencies
|
||||||
|
|
Loading…
Reference in New Issue