Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- uses: aboutbits/github-actions-java/setup-with-maven@v4
with:
java-version: 21
java-version: 25
- name: Test
env:
GITHUB_USER_NAME: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7
with:
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
- uses: aboutbits/github-actions-base/git-setup@v2
- uses: aboutbits/github-actions-java/setup-with-maven@v4
with:
java-version: 21
java-version: 25
- uses: aboutbits/github-actions-java/set-version-with-maven@v4
with:
version: "${{ github.event.inputs.version }}"
Expand Down
4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 68 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<version>4.0.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -16,10 +16,22 @@
<description>Spring Boot Email Service</description>

<properties>
<java.version>21</java.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<java.version>25</java.version>
<mapstruct.version>1.6.3</mapstruct.version>
<nullaway.version>0.13.2</nullaway.version>
<errorprone.version>2.49.0</errorprone.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>it.aboutbits</groupId>
<artifactId>archunit-toolbox</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -57,49 +69,59 @@
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-63</artifactId>
<version>3.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
<groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId>
<version>2.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.18.0</version>
<version>2.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.18.0</version>
<artifactId>testcontainers-junit-jupiter</artifactId>
<version>2.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.18.0</version>
<artifactId>testcontainers-postgresql</artifactId>
<version>2.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit5</artifactId>
<version>1.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>it.aboutbits</groupId>
<artifactId>archunit-toolbox</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>it.aboutbits</groupId>
<artifactId>spring-boot-testing</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.15.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand All @@ -119,17 +141,43 @@
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${errorprone.version}</version>
</path>
<path>
<groupId>com.uber.nullaway</groupId>
<artifactId>nullaway</artifactId>
<version>${nullaway.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amapstruct.defaultComponentModel=spring</arg>
<arg>-Amapstruct.unmappedTargetPolicy=ERROR</arg>
<arg>-XDcompilePolicy=simple</arg>
<arg>--should-stop=ifError=FLOW</arg>
<!-- @formatter:off -->
<arg>-Xplugin:ErrorProne -XepDisableAllChecks -XepOpt:NullAway:AnnotatedPackages=it.aboutbits.springboot.emailservice -XepOpt:NullAway:JSpecifyMode=true -Xep:NullAway:ERROR -XepOpt:NullAway:ExcludedFieldAnnotations=org.mockito.InjectMocks,org.mockito.Mock</arg>
<!-- @formatter:on -->
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
</compilerArgs>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.1</version>
<version>3.6.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<suppressionsFileExpression>
Expand All @@ -154,7 +202,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.3.4</version>
<version>13.5.0</version>
</dependency>
</dependencies>
</plugin>
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A reusable mailer service to send emails.

## Setup

Add the mailer service to the classpath by adding the following maven dependency. Versions haven be found [here](../../packages)
Add the mailer service to the classpath by adding the following maven dependency. Versions can be found [here](../../packages)

```xml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import it.aboutbits.springboot.emailservice.lib.application.UnavailableAttachmentDataSource;
import it.aboutbits.springboot.emailservice.lib.jpa.EmailRepository;
import jakarta.persistence.EntityManager;
import org.jspecify.annotations.NullMarked;
import org.springframework.boot.autoconfigure.AutoConfigurationPackage;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand All @@ -25,6 +26,7 @@
import java.util.List;

@AutoConfigurationPackage
@NullMarked
public class EmailServiceConfiguration {
@Bean(initMethod = "migrate")
@ConditionalOnProperty(value = "aboutbits.emailservice.migrations.enabled", matchIfMissing = true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package it.aboutbits.springboot.emailservice.lib;

import org.jspecify.annotations.NullMarked;

@NullMarked
public interface AttachmentCleanerCallback {
void report(Report report);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package it.aboutbits.springboot.emailservice.lib;

import it.aboutbits.springboot.emailservice.lib.exception.AttachmentException;
import org.jspecify.annotations.NullMarked;

import java.io.InputStream;

@NullMarked
public interface AttachmentDataSource {
InputStream getAttachmentPayload(long fileReference) throws AttachmentException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package it.aboutbits.springboot.emailservice.lib;

import it.aboutbits.springboot.emailservice.lib.model.Email;
import org.jspecify.annotations.NullMarked;

@NullMarked
public record EmailAttachmentDto(
long id,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package it.aboutbits.springboot.emailservice.lib;

import org.springframework.lang.Nullable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.time.OffsetDateTime;
import java.util.List;
import java.util.Set;

@NullMarked
public record EmailDto(
long id,

Expand All @@ -29,9 +31,12 @@ public record EmailDto(
Set<EmailAttachmentDto> attachments,

OffsetDateTime scheduledAt,
@Nullable
OffsetDateTime sentAt,

@Nullable
OffsetDateTime errorAt,
@Nullable
String errorMessage,

OffsetDateTime createdAt,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package it.aboutbits.springboot.emailservice.lib;

import org.jspecify.annotations.NullMarked;

@NullMarked
public interface EmailSchedulerCallback {
void report(Report report);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package it.aboutbits.springboot.emailservice.lib;

import org.jspecify.annotations.NullMarked;

@NullMarked
public enum EmailState {
PENDING,
SENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import it.aboutbits.springboot.emailservice.lib.exception.AttachmentException;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.jspecify.annotations.NullMarked;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.Duration;
import java.util.List;

@RequiredArgsConstructor
@Log4j2
@NullMarked
public class CleanupAttachmentFiles {
private static final String JOB_DESCRIPTION = "Cleanup attachments of sent Emails.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

import it.aboutbits.springboot.emailservice.lib.EmailAttachmentDto;
import it.aboutbits.springboot.emailservice.lib.model.EmailAttachment;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullUnmarked;
import org.mapstruct.AnnotateWith;
import org.mapstruct.Mapper;

import java.util.List;

@Mapper
@AnnotateWith(NullUnmarked.class)
@NullMarked
public interface EmailAttachmentMapper {
EmailAttachmentDto toDto(EmailAttachment model);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

import it.aboutbits.springboot.emailservice.lib.EmailDto;
import it.aboutbits.springboot.emailservice.lib.model.Email;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullUnmarked;
import org.mapstruct.AnnotateWith;
import org.mapstruct.Mapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;

import java.util.List;

@Mapper(uses = EmailAttachmentMapper.class)
@AnnotateWith(NullUnmarked.class)
@NullMarked
public interface EmailMapper {
EmailDto toDto(Email model);

Expand Down
Loading