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.
This commit is contained in:
Paul Campbell 2022-01-23 14:40:13 +00:00 committed by GitHub
parent 8dab6e2c08
commit 7d3af91b8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 41 deletions

15
pom.xml
View file

@ -12,19 +12,17 @@
</parent> </parent>
<artifactId>kemitix-trello</artifactId> <artifactId>kemitix-trello</artifactId>
<version>1.1.0</version> <version>2.0.0</version>
<properties> <properties>
<tiles-maven-plugin.version>2.18</tiles-maven-plugin.version> <tiles-maven-plugin.version>2.18</tiles-maven-plugin.version>
<kemitix-tiles.version>2.10.0</kemitix-tiles.version> <kemitix-tiles.version>2.10.0</kemitix-tiles.version>
<trello-java-wrapper.version>0.14</trello-java-wrapper.version> <trello-java-wrapper.version>0.14</trello-java-wrapper.version>
<lombok.version>1.18.16</lombok.version> <lombok.version>1.18.22</lombok.version>
<camel-api.version>3.6.0</camel-api.version> <camel-api.version>3.12.0</camel-api.version>
<junit.version>5.6.1</junit.version> <junit.version>5.8.2</junit.version>
<assertj.version>3.18.1</assertj.version> <assertj.version>3.18.1</assertj.version>
<jakarta.enterprise.cdi-api.version>2.0.2
</jakarta.enterprise.cdi-api.version>
</properties> </properties>
<dependencies> <dependencies>
@ -44,11 +42,6 @@
<artifactId>camel-api</artifactId> <artifactId>camel-api</artifactId>
<version>${camel-api.version}</version> <version>${camel-api.version}</version>
</dependency> </dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>${jakarta.enterprise.cdi-api.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>

View file

@ -1,8 +1,5 @@
package net.kemitix.trello; package net.kemitix.trello;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.enterprise.context.ApplicationScoped;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -11,7 +8,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
@ApplicationScoped
public class AttachmentDirectoryImpl implements AttachmentDirectory { public class AttachmentDirectoryImpl implements AttachmentDirectory {
private static final Logger LOG = private static final Logger LOG =
@ -22,7 +18,6 @@ public class AttachmentDirectoryImpl implements AttachmentDirectory {
private Path dir; private Path dir;
private List<File> toDelete = new ArrayList<>(); private List<File> toDelete = new ArrayList<>();
@PostConstruct
public void init() throws IOException { public void init() throws IOException {
dir = Files.createTempDirectory("attachments"); dir = Files.createTempDirectory("attachments");
LOG.info("Attachments directory: " + dir); LOG.info("Attachments directory: " + dir);
@ -38,7 +33,6 @@ public class AttachmentDirectoryImpl implements AttachmentDirectory {
return file; return file;
} }
@PreDestroy
public void deleteFiles() { public void deleteFiles() {
toDelete.stream() toDelete.stream()
.peek(file -> LOG.info("Deleting: " + file)) .peek(file -> LOG.info("Deleting: " + file))

View file

@ -2,16 +2,12 @@ package net.kemitix.trello;
import org.apache.camel.Header; import org.apache.camel.Header;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.util.Objects; import java.util.Objects;
@ApplicationScoped
public class LoadCard { public class LoadCard {
private final TrelloBoard trelloBoard; private final TrelloBoard trelloBoard;
@Inject
public LoadCard(TrelloBoard trelloBoard) { public LoadCard(TrelloBoard trelloBoard) {
this.trelloBoard = trelloBoard; this.trelloBoard = trelloBoard;
} }

View file

@ -6,9 +6,6 @@ import com.julienvey.trello.domain.*;
import com.julienvey.trello.domain.Attachment; import com.julienvey.trello.domain.Attachment;
import lombok.extern.java.Log; 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.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -16,7 +13,6 @@ import java.util.stream.Stream;
import static net.kemitix.trello.ListUtils.map; import static net.kemitix.trello.ListUtils.map;
@Log @Log
@ApplicationScoped
public class TrelloBoard { public class TrelloBoard {
private final Trello trello; private final Trello trello;
@ -24,7 +20,6 @@ public class TrelloBoard {
private List<TList> lists; private List<TList> lists;
@Inject
public TrelloBoard( public TrelloBoard(
Trello trello, Trello trello,
TrelloConfig trelloConfig TrelloConfig trelloConfig
@ -33,8 +28,7 @@ public class TrelloBoard {
this.trelloConfig = trelloConfig; this.trelloConfig = trelloConfig;
} }
@PostConstruct public void init () {
void init () {
lists = board().fetchLists(); lists = board().fetchLists();
} }

View file

@ -5,21 +5,14 @@ import com.julienvey.trello.TrelloHttpClient;
import com.julienvey.trello.domain.Member; import com.julienvey.trello.domain.Member;
import com.julienvey.trello.impl.http.JDKTrelloHttpClient; import com.julienvey.trello.impl.http.JDKTrelloHttpClient;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
@ApplicationScoped
public class TrelloProducers { public class TrelloProducers {
@Produces public TrelloHttpClient trelloHttpClient() {
@ApplicationScoped
TrelloHttpClient trelloHttpClient() {
return new JDKTrelloHttpClient(); return new JDKTrelloHttpClient();
} }
@Produces public TrelloClient trello(
@ApplicationScoped
TrelloClient trello(
TrelloConfig config, TrelloConfig config,
TrelloHttpClient httpClient TrelloHttpClient httpClient
) { ) {
@ -29,9 +22,7 @@ public class TrelloProducers {
httpClient); httpClient);
} }
@Produces public Member member(Trello trello, TrelloConfig trelloConfig) {
@ApplicationScoped
Member member(Trello trello, TrelloConfig trelloConfig) {
return trello.getMemberInformation(trelloConfig.getUserName()); return trello.getMemberInformation(trelloConfig.getUserName());
} }