From 7d3af91b8c87ba00716cec49433292dfb7fd29c0 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 23 Jan 2022 14:40:13 +0000 Subject: [PATCH] Remove beans - v2.0.0 (#14) * remove beans.xml * remove java ee dependency and javax annotations * Bump dependencies * Version set to 2.0.0 This is a breaking change to any library that depended upon the Java EE annotation to instantiate these classes. They will now need to instantiate them themselves. --- pom.xml | 17 +++++------------ .../kemitix/trello/AttachmentDirectoryImpl.java | 6 ------ src/main/java/net/kemitix/trello/LoadCard.java | 4 ---- .../java/net/kemitix/trello/TrelloBoard.java | 8 +------- .../net/kemitix/trello/TrelloProducers.java | 15 +++------------ src/main/resources/META-INF/beans.xml | 0 6 files changed, 9 insertions(+), 41 deletions(-) delete mode 100644 src/main/resources/META-INF/beans.xml diff --git a/pom.xml b/pom.xml index 03c762b..62c40b4 100644 --- a/pom.xml +++ b/pom.xml @@ -12,19 +12,17 @@ kemitix-trello - 1.1.0 + 2.0.0 2.18 2.10.0 0.14 - 1.18.16 - 3.6.0 - 5.6.1 + 1.18.22 + 3.12.0 + 5.8.2 3.18.1 - 2.0.2 - @@ -44,11 +42,6 @@ camel-api ${camel-api.version} - - jakarta.enterprise - jakarta.enterprise.cdi-api - ${jakarta.enterprise.cdi-api.version} - org.junit.jupiter @@ -89,4 +82,4 @@ - \ No newline at end of file + diff --git a/src/main/java/net/kemitix/trello/AttachmentDirectoryImpl.java b/src/main/java/net/kemitix/trello/AttachmentDirectoryImpl.java index 44b7a4a..0fbd4c4 100644 --- a/src/main/java/net/kemitix/trello/AttachmentDirectoryImpl.java +++ b/src/main/java/net/kemitix/trello/AttachmentDirectoryImpl.java @@ -1,8 +1,5 @@ package net.kemitix.trello; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.enterprise.context.ApplicationScoped; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -11,7 +8,6 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; -@ApplicationScoped public class AttachmentDirectoryImpl implements AttachmentDirectory { private static final Logger LOG = @@ -22,7 +18,6 @@ public class AttachmentDirectoryImpl implements AttachmentDirectory { private Path dir; private List toDelete = new ArrayList<>(); - @PostConstruct public void init() throws IOException { dir = Files.createTempDirectory("attachments"); LOG.info("Attachments directory: " + dir); @@ -38,7 +33,6 @@ public class AttachmentDirectoryImpl implements AttachmentDirectory { return file; } - @PreDestroy public void deleteFiles() { toDelete.stream() .peek(file -> LOG.info("Deleting: " + file)) diff --git a/src/main/java/net/kemitix/trello/LoadCard.java b/src/main/java/net/kemitix/trello/LoadCard.java index e1c9171..618783e 100644 --- a/src/main/java/net/kemitix/trello/LoadCard.java +++ b/src/main/java/net/kemitix/trello/LoadCard.java @@ -2,16 +2,12 @@ package net.kemitix.trello; import org.apache.camel.Header; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; import java.util.Objects; -@ApplicationScoped public class LoadCard { private final TrelloBoard trelloBoard; - @Inject public LoadCard(TrelloBoard trelloBoard) { this.trelloBoard = trelloBoard; } diff --git a/src/main/java/net/kemitix/trello/TrelloBoard.java b/src/main/java/net/kemitix/trello/TrelloBoard.java index 497115b..e8e2753 100644 --- a/src/main/java/net/kemitix/trello/TrelloBoard.java +++ b/src/main/java/net/kemitix/trello/TrelloBoard.java @@ -6,9 +6,6 @@ import com.julienvey.trello.domain.*; import com.julienvey.trello.domain.Attachment; import lombok.extern.java.Log; -import javax.annotation.PostConstruct; -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -16,7 +13,6 @@ import java.util.stream.Stream; import static net.kemitix.trello.ListUtils.map; @Log -@ApplicationScoped public class TrelloBoard { private final Trello trello; @@ -24,7 +20,6 @@ public class TrelloBoard { private List lists; - @Inject public TrelloBoard( Trello trello, TrelloConfig trelloConfig @@ -33,8 +28,7 @@ public class TrelloBoard { this.trelloConfig = trelloConfig; } - @PostConstruct - void init () { + public void init () { lists = board().fetchLists(); } diff --git a/src/main/java/net/kemitix/trello/TrelloProducers.java b/src/main/java/net/kemitix/trello/TrelloProducers.java index a4435ec..bcfc774 100644 --- a/src/main/java/net/kemitix/trello/TrelloProducers.java +++ b/src/main/java/net/kemitix/trello/TrelloProducers.java @@ -5,21 +5,14 @@ import com.julienvey.trello.TrelloHttpClient; import com.julienvey.trello.domain.Member; import com.julienvey.trello.impl.http.JDKTrelloHttpClient; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Produces; -@ApplicationScoped public class TrelloProducers { - @Produces - @ApplicationScoped - TrelloHttpClient trelloHttpClient() { + public TrelloHttpClient trelloHttpClient() { return new JDKTrelloHttpClient(); } - @Produces - @ApplicationScoped - TrelloClient trello( + public TrelloClient trello( TrelloConfig config, TrelloHttpClient httpClient ) { @@ -29,9 +22,7 @@ public class TrelloProducers { httpClient); } - @Produces - @ApplicationScoped - Member member(Trello trello, TrelloConfig trelloConfig) { + public Member member(Trello trello, TrelloConfig trelloConfig) { return trello.getMemberInformation(trelloConfig.getUserName()); } diff --git a/src/main/resources/META-INF/beans.xml b/src/main/resources/META-INF/beans.xml deleted file mode 100644 index e69de29..0000000