deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14403 additions and 17632 deletions
@@ -26,15 +26,11 @@ package com.iluwatar.lazy.loading;
import lombok.extern.slf4j.Slf4j;
/**
* Heavy objects are expensive to create.
*/
/** Heavy objects are expensive to create. */
@Slf4j
public class Heavy {
/**
* Constructor.
*/
/** Constructor. */
public Heavy() {
LOGGER.info("Creating Heavy ...");
try {
@@ -26,24 +26,18 @@ package com.iluwatar.lazy.loading;
import lombok.extern.slf4j.Slf4j;
/**
* Simple implementation of the lazy loading idiom. However, this is not thread safe.
*/
/** Simple implementation of the lazy loading idiom. However, this is not thread safe. */
@Slf4j
public class HolderNaive {
private Heavy heavy;
/**
* Constructor.
*/
/** Constructor. */
public HolderNaive() {
LOGGER.info("HolderNaive created");
}
/**
* Get heavy object.
*/
/** Get heavy object. */
public Heavy getHeavy() {
if (heavy == null) {
heavy = new Heavy();
@@ -35,16 +35,12 @@ public class HolderThreadSafe {
private Heavy heavy;
/**
* Constructor.
*/
/** Constructor. */
public HolderThreadSafe() {
LOGGER.info("HolderThreadSafe created");
}
/**
* Get heavy object.
*/
/** Get heavy object. */
public synchronized Heavy getHeavy() {
if (heavy == null) {
heavy = new Heavy();
@@ -32,10 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertTimeout;
import org.junit.jupiter.api.Test;
/**
* AbstractHolderTest
*
*/
/** AbstractHolderTest */
public abstract class AbstractHolderTest {
/**
@@ -57,12 +54,13 @@ public abstract class AbstractHolderTest {
*/
@Test
void testGetHeavy() {
assertTimeout(ofMillis(3000), () -> {
assertNull(getInternalHeavyValue());
assertNotNull(getHeavy());
assertNotNull(getInternalHeavyValue());
assertSame(getHeavy(), getInternalHeavyValue());
});
assertTimeout(
ofMillis(3000),
() -> {
assertNull(getInternalHeavyValue());
assertNotNull(getHeavy());
assertNotNull(getInternalHeavyValue());
assertSame(getHeavy(), getInternalHeavyValue());
});
}
}
@@ -24,19 +24,15 @@
*/
package com.iluwatar.lazy.loading;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/**
*
* Application test
*
*/
import org.junit.jupiter.api.Test;
/** Application test */
class AppTest {
@Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
assertDoesNotThrow(() -> App.main(new String[] {}));
}
}
@@ -24,10 +24,7 @@
*/
package com.iluwatar.lazy.loading;
/**
* HolderNaiveTest
*
*/
/** HolderNaiveTest */
class HolderNaiveTest extends AbstractHolderTest {
private final HolderNaive holder = new HolderNaive();
@@ -43,5 +40,4 @@ class HolderNaiveTest extends AbstractHolderTest {
Heavy getHeavy() {
return holder.getHeavy();
}
}
}
@@ -24,10 +24,7 @@
*/
package com.iluwatar.lazy.loading;
/**
* HolderThreadSafeTest
*
*/
/** HolderThreadSafeTest */
class HolderThreadSafeTest extends AbstractHolderTest {
private final HolderThreadSafe holder = new HolderThreadSafe();
@@ -43,5 +40,4 @@ class HolderThreadSafeTest extends AbstractHolderTest {
Heavy getHeavy() {
return this.holder.getHeavy();
}
}
}
@@ -26,15 +26,11 @@ package com.iluwatar.lazy.loading;
import java.util.function.Supplier;
/**
* Java8HolderTest
*
*/
/** Java8HolderTest */
class Java8HolderTest extends AbstractHolderTest {
private final Java8Holder holder = new Java8Holder();
@Override
Heavy getInternalHeavyValue() throws Exception {
final var holderField = Java8Holder.class.getDeclaredField("heavy");
@@ -58,5 +54,4 @@ class Java8HolderTest extends AbstractHolderTest {
Heavy getHeavy() {
return holder.getHeavy();
}
}
}