Skip to content

Commit ec110e7

Browse files
committed
add: reactify-cache
1 parent d76fccf commit ec110e7

File tree

9 files changed

+734
-0
lines changed

9 files changed

+734
-0
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
<modules>
9494
<module>reactify-core</module>
9595
<module>reactify-utils</module>
96+
<module>reactify-cache</module>
9697
</modules>
9798

9899
<dependencies>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

reactify-cache/pom.xml

Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>3.3.2</version>
9+
<relativePath/>
10+
</parent>
11+
<groupId>io.hoangtien2k3.cache</groupId>
12+
<artifactId>reactify-cache</artifactId>
13+
<version>1.1.6</version>
14+
<name>reactify-cache</name>
15+
<packaging>jar</packaging>
16+
<description>Java lib using caffeine cache</description>
17+
<url>https://github.com/hoangtien2k3/reactify</url>
18+
19+
<licenses>
20+
<license>
21+
<name>Apache License, Version 2.0</name>
22+
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
23+
</license>
24+
</licenses>
25+
<developers>
26+
<developer>
27+
<name>Hoang Anh Tien</name>
28+
<email>[email protected]</email>
29+
<organization>io.github.hoangtien2k3</organization>
30+
<organizationUrl>https://github.com/hoangtien2k3</organizationUrl>
31+
</developer>
32+
</developers>
33+
<scm>
34+
<connection>scm:git:git://github.com/hoangtien2k3/reactify.git</connection>
35+
<developerConnection>scm:git:ssh://[email protected]:hoangtien2k3/reactify.git</developerConnection>
36+
<url>https://github.com/hoangtien2k3/reactify</url>
37+
</scm>
38+
<distributionManagement>
39+
<snapshotRepository>
40+
<id>ossrh</id>
41+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
42+
</snapshotRepository>
43+
<repository>
44+
<id>ossrh</id>
45+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
46+
</repository>
47+
</distributionManagement>
48+
49+
<properties>
50+
<java.version>21</java.version>
51+
<micrometer.tracing.version>1.3.1</micrometer.tracing.version>
52+
<micrometer.registry.version>1.13.1</micrometer.registry.version>
53+
<micrometer.core.version>1.13.1</micrometer.core.version>
54+
<spring-cloud.version>2023.0.2</spring-cloud.version>
55+
<spotless.version>2.43.0</spotless.version>
56+
<log4j.version>2.23.1</log4j.version>
57+
<minio.version>8.5.11</minio.version>
58+
<mapstruct.version>1.5.5.Final</mapstruct.version>
59+
<mapstruct.processor.version>1.5.5.Final</mapstruct.processor.version>
60+
<modelmapper.version>3.2.0</modelmapper.version>
61+
<lombok.version>1.18.32</lombok.version>
62+
<javax.annotation.version>1.3.2</javax.annotation.version>
63+
<jackson.databind.version>2.17.1</jackson.databind.version>
64+
<spotless.version>2.43.0</spotless.version>
65+
<file.encoding>UTF-8</file.encoding>
66+
<!-- Plugins version -->
67+
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
68+
<maven-surefire-plugin.version>3.4.0</maven-surefire-plugin.version>
69+
<central-publishing-maven-plugin.version>0.6.0</central-publishing-maven-plugin.version>
70+
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
71+
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
72+
<maven-javadoc-plugin.version>3.8.0</maven-javadoc-plugin.version>
73+
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
74+
<!-- Sonar Cloud -->
75+
<sonar.organization>hoangtien2k3</sonar.organization>
76+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
77+
</properties>
78+
79+
<dependencies>
80+
<dependency>
81+
<groupId>org.springframework.boot</groupId>
82+
<artifactId>spring-boot-starter</artifactId>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.aspectj</groupId>
86+
<artifactId>aspectjweaver</artifactId>
87+
<version>1.9.22.1</version>
88+
</dependency>
89+
<dependency>
90+
<groupId>com.github.ben-manes.caffeine</groupId>
91+
<artifactId>caffeine</artifactId>
92+
<version>3.1.8</version>
93+
</dependency>
94+
<dependency>
95+
<groupId>javax.annotation</groupId>
96+
<artifactId>javax.annotation-api</artifactId>
97+
<version>1.3.2</version>
98+
</dependency>
99+
<dependency>
100+
<groupId>org.reflections</groupId>
101+
<artifactId>reflections</artifactId>
102+
<version>0.10.2</version>
103+
</dependency>
104+
<dependency>
105+
<groupId>javax.annotation</groupId>
106+
<artifactId>javax.annotation-api</artifactId>
107+
<version>1.3.2</version>
108+
</dependency>
109+
<dependency>
110+
<groupId>org.projectlombok</groupId>
111+
<artifactId>lombok</artifactId>
112+
<version>1.18.32</version>
113+
<scope>provided</scope>
114+
</dependency>
115+
<dependency>
116+
<groupId>io.projectreactor.addons</groupId>
117+
<artifactId>reactor-extra</artifactId>
118+
<version>3.5.2</version>
119+
</dependency>
120+
</dependencies>
121+
122+
<build>
123+
<plugins>
124+
<plugin>
125+
<groupId>org.apache.maven.plugins</groupId>
126+
<artifactId>maven-compiler-plugin</artifactId>
127+
<version>${maven-compiler-plugin.version}</version>
128+
<configuration>
129+
<source>${java.version}</source>
130+
<target>${java.version}</target>
131+
</configuration>
132+
</plugin>
133+
<plugin>
134+
<groupId>org.sonatype.central</groupId>
135+
<artifactId>central-publishing-maven-plugin</artifactId>
136+
<version>${central-publishing-maven-plugin.version}</version>
137+
<extensions>true</extensions>
138+
<configuration>
139+
<publishingServerId>central</publishingServerId>
140+
<autoPublish>true</autoPublish>
141+
<waitUntil>published</waitUntil>
142+
</configuration>
143+
</plugin>
144+
<plugin>
145+
<groupId>org.apache.maven.plugins</groupId>
146+
<artifactId>maven-source-plugin</artifactId>
147+
<version>${maven-source-plugin.version}</version>
148+
<executions>
149+
<execution>
150+
<id>attach-sources</id>
151+
<goals>
152+
<goal>jar-no-fork</goal>
153+
</goals>
154+
</execution>
155+
</executions>
156+
</plugin>
157+
<plugin>
158+
<groupId>org.apache.maven.plugins</groupId>
159+
<artifactId>maven-javadoc-plugin</artifactId>
160+
<version>${maven-javadoc-plugin.version}</version>
161+
<configuration>
162+
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
163+
<failOnError>false</failOnError>
164+
</configuration>
165+
<executions>
166+
<execution>
167+
<id>generate-javadocs</id>
168+
<phase>prepare-package</phase>
169+
<goals>
170+
<goal>javadoc</goal>
171+
</goals>
172+
</execution>
173+
<execution>
174+
<id>attach-javadocs</id>
175+
<goals>
176+
<goal>jar</goal>
177+
</goals>
178+
</execution>
179+
</executions>
180+
</plugin>
181+
<plugin>
182+
<groupId>org.apache.maven.plugins</groupId>
183+
<artifactId>maven-gpg-plugin</artifactId>
184+
<version>${maven-gpg-plugin.version}</version>
185+
<executions>
186+
<execution>
187+
<id>sign-artifacts</id>
188+
<phase>verify</phase>
189+
<goals>
190+
<goal>sign</goal>
191+
</goals>
192+
</execution>
193+
</executions>
194+
</plugin>
195+
<plugin>
196+
<groupId>org.sonatype.plugins</groupId>
197+
<artifactId>nexus-staging-maven-plugin</artifactId>
198+
<version>${nexus-staging-maven-plugin.version}</version>
199+
<extensions>true</extensions>
200+
<configuration>
201+
<serverId>ossrh</serverId>
202+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
203+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
204+
</configuration>
205+
</plugin>
206+
<plugin>
207+
<groupId>org.springframework.boot</groupId>
208+
<artifactId>spring-boot-maven-plugin</artifactId>
209+
<configuration>
210+
<excludes>
211+
<exclude>
212+
<groupId>org.projectlombok</groupId>
213+
<artifactId>lombok</artifactId>
214+
</exclude>
215+
</excludes>
216+
<skip>true</skip>
217+
</configuration>
218+
</plugin>
219+
<plugin>
220+
<groupId>com.diffplug.spotless</groupId>
221+
<artifactId>spotless-maven-plugin</artifactId>
222+
<version>${spotless.version}</version>
223+
<configuration>
224+
<java>
225+
<eclipse>
226+
</eclipse>
227+
<indent>
228+
<tabs>true</tabs>
229+
<spacesPerTab>2</spacesPerTab>
230+
</indent>
231+
<indent>
232+
<spaces>true</spaces>
233+
<spacesPerTab>2</spacesPerTab>
234+
</indent>
235+
<removeUnusedImports/>
236+
<palantirJavaFormat/>
237+
</java>
238+
</configuration>
239+
<executions>
240+
<execution>
241+
<id>java-formatter</id>
242+
<goals>
243+
<goal>check</goal>
244+
</goals>
245+
<phase>validate</phase>
246+
</execution>
247+
</executions>
248+
</plugin>
249+
<plugin>
250+
<groupId>com.mycila</groupId>
251+
<artifactId>license-maven-plugin</artifactId>
252+
<version>4.0.rc2</version>
253+
<configuration>
254+
<licenseSets>
255+
<licenseSet>
256+
<header>${project.basedir}/src/main/resources/header.txt</header>
257+
<includes>
258+
<include>**/*.java</include>
259+
</includes>
260+
</licenseSet>
261+
</licenseSets>
262+
</configuration>
263+
<executions>
264+
<execution>
265+
<goals>
266+
<goal>format</goal>
267+
</goals>
268+
</execution>
269+
</executions>
270+
</plugin>
271+
</plugins>
272+
</build>
273+
274+
</project>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2024 the original author Hoàng Anh Tiến.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.hoangtien2k3.cache;
17+
18+
import org.springframework.beans.BeansException;
19+
import org.springframework.context.ApplicationContext;
20+
import org.springframework.context.ApplicationContextAware;
21+
import org.springframework.stereotype.Component;
22+
23+
/**
24+
* <p>
25+
* ApplicationContextProvider class.
26+
* </p>
27+
*
28+
* @author hoangtien2k3
29+
*/
30+
@Component
31+
public class ApplicationContextProvider implements ApplicationContextAware {
32+
33+
private static ApplicationContext context;
34+
35+
/**
36+
* <p>
37+
* getApplicationContext.
38+
* </p>
39+
*
40+
* @return a {@link ApplicationContext} object
41+
*/
42+
public static ApplicationContext getApplicationContext() {
43+
return context;
44+
}
45+
46+
/** {@inheritDoc} */
47+
@SuppressWarnings("squid:S2696")
48+
@Override
49+
public void setApplicationContext(ApplicationContext ac) throws BeansException {
50+
context = ac;
51+
}
52+
}

0 commit comments

Comments
 (0)