├── .gitattributes
├── .github
├── stale.yml
└── workflows
│ └── maven.yml
├── .gitignore
├── LICENSE
├── README.md
├── aquarius-cache-aop
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── cache
│ ├── CacheDelegate.java
│ ├── annotation
│ ├── CacheEvict.java
│ ├── CachePut.java
│ └── Cacheable.java
│ ├── aop
│ ├── CacheAutoScanProxy.java
│ └── CacheInterceptor.java
│ ├── configuration
│ └── CacheAopConfiguration.java
│ └── constant
│ └── CacheConstant.java
├── aquarius-cache-redis
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── cache
│ └── redis
│ ├── condition
│ └── RedisCacheCondition.java
│ ├── configuration
│ ├── RedisCacheConfiguration.java
│ └── RedissonCacheConfiguration.java
│ └── impl
│ ├── RedisCacheDelegateImpl.java
│ └── RedissonCacheDelegateImpl.java
├── aquarius-cache-starter
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── nepxion
│ │ └── aquarius
│ │ └── cache
│ │ ├── annotation
│ │ └── EnableCache.java
│ │ ├── aop
│ │ └── CacheImportSelector.java
│ │ └── configuration
│ │ └── CacheConfiguration.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── aquarius-common-redis
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── common
│ ├── redis
│ ├── configuration
│ │ └── RedisConfiguration.java
│ ├── constant
│ │ └── RedisConstant.java
│ ├── exception
│ │ └── RedisException.java
│ └── handler
│ │ ├── RedisHandler.java
│ │ └── RedisHandlerImpl.java
│ └── redisson
│ ├── adapter
│ └── RedissonAdapter.java
│ ├── constant
│ └── RedissonConstant.java
│ ├── exception
│ └── RedissonException.java
│ ├── handler
│ ├── RedissonHandler.java
│ └── RedissonHandlerImpl.java
│ └── util
│ └── RedissonUtil.java
├── aquarius-common-zookeeper
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── common
│ └── curator
│ ├── constant
│ └── CuratorConstant.java
│ ├── entity
│ └── RetryTypeEnum.java
│ ├── exception
│ └── CuratorException.java
│ └── handler
│ ├── CuratorHandler.java
│ └── CuratorHandlerImpl.java
├── aquarius-common
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── nepxion
│ │ └── aquarius
│ │ └── common
│ │ ├── condition
│ │ └── AquariusCondition.java
│ │ ├── configuration
│ │ └── AquariusConfiguration.java
│ │ ├── constant
│ │ └── AquariusConstant.java
│ │ ├── context
│ │ └── AquariusContextAware.java
│ │ ├── exception
│ │ └── AquariusException.java
│ │ ├── property
│ │ ├── AquariusContent.java
│ │ └── AquariusProperties.java
│ │ └── util
│ │ ├── DateUtil.java
│ │ ├── IOUtil.java
│ │ ├── KeyUtil.java
│ │ ├── MathsUtil.java
│ │ └── StringUtil.java
│ └── resources
│ └── com
│ └── nepxion
│ └── aquarius
│ └── resource
│ └── logo.txt
├── aquarius-id-generator-local
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── idgenerator
│ └── local
│ ├── LocalIdGenerator.java
│ ├── configuration
│ └── LocalIdGeneratorConfiguration.java
│ └── impl
│ ├── LocalIdGeneratorImpl.java
│ └── SnowflakeIdGenerator.java
├── aquarius-id-generator-redis
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── idgenerator
│ └── redis
│ ├── RedisIdGenerator.java
│ ├── configuration
│ └── RedisIdGeneratorConfiguration.java
│ └── impl
│ └── RedisIdGeneratorImpl.java
├── aquarius-id-generator-starter
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── nepxion
│ │ └── aquarius
│ │ └── idgenerator
│ │ ├── annotation
│ │ ├── EnableLocalIdGenerator.java
│ │ ├── EnableRedisIdGenerator.java
│ │ └── EnableZookeeperIdGenerator.java
│ │ ├── aop
│ │ ├── LocalIdGeneratorImportSelector.java
│ │ ├── RedisIdGeneratorImportSelector.java
│ │ └── ZookeeperIdGeneratorImportSelector.java
│ │ ├── configuration
│ │ ├── LocalIdGeneratorConfig.java
│ │ ├── RedisIdGeneratorConfig.java
│ │ └── ZookeeperIdGeneratorConfig.java
│ │ └── constant
│ │ └── IdGeneratorConstant.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── aquarius-id-generator-zookeeper
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── idgenerator
│ └── zookeeper
│ ├── ZookeeperIdGenerator.java
│ ├── configuration
│ └── ZookeeperIdGeneratorConfiguration.java
│ └── impl
│ └── ZookeeperIdGeneratorImpl.java
├── aquarius-limit-aop
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── limit
│ ├── LimitDelegate.java
│ ├── LimitExecutor.java
│ ├── annotation
│ └── Limit.java
│ ├── aop
│ ├── LimitAutoScanProxy.java
│ └── LimitInterceptor.java
│ ├── configuration
│ └── LimitAopConfiguration.java
│ └── constant
│ └── LimitConstant.java
├── aquarius-limit-local
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── limit
│ └── local
│ ├── condition
│ └── LocalLimitCondition.java
│ ├── configuration
│ └── LocalLimitConfiguration.java
│ └── impl
│ ├── GuavaLocalLimitExecutorImpl.java
│ ├── JdkLimitExecutorImpl.java
│ └── LocalLimitDelegateImpl.java
├── aquarius-limit-redis
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── limit
│ └── redis
│ ├── condition
│ └── RedisLimitCondition.java
│ ├── configuration
│ └── RedisLimitConfiguration.java
│ └── impl
│ ├── RedisLimitDelegateImpl.java
│ └── RedisLimitExecutorImpl.java
├── aquarius-limit-starter
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── nepxion
│ │ └── aquarius
│ │ └── limit
│ │ ├── annotation
│ │ └── EnableLimit.java
│ │ ├── aop
│ │ └── LimitImportSelector.java
│ │ └── configuration
│ │ └── LimitConfiguration.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── aquarius-lock-aop
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── lock
│ ├── LockDelegate.java
│ ├── LockExecutor.java
│ ├── annotation
│ ├── Lock.java
│ ├── ReadLock.java
│ └── WriteLock.java
│ ├── aop
│ ├── LockAutoScanProxy.java
│ └── LockInterceptor.java
│ ├── configuration
│ └── LockAopConfiguration.java
│ ├── constant
│ └── LockConstant.java
│ └── entity
│ └── LockType.java
├── aquarius-lock-local
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── lock
│ └── local
│ ├── condition
│ └── LocalLockCondition.java
│ ├── configuration
│ └── LocalLockConfiguration.java
│ └── impl
│ ├── LocalLockDelegateImpl.java
│ └── LocalLockExecutorImpl.java
├── aquarius-lock-redis
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── lock
│ └── redis
│ ├── condition
│ └── RedisLockCondition.java
│ ├── configuration
│ └── RedisLockConfiguration.java
│ └── impl
│ ├── RedisLockDelegateImpl.java
│ └── RedisLockExecutorImpl.java
├── aquarius-lock-starter
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── nepxion
│ │ └── aquarius
│ │ └── lock
│ │ ├── annotation
│ │ └── EnableLock.java
│ │ ├── aop
│ │ └── LockImportSelector.java
│ │ └── configuration
│ │ └── LockConfiguration.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── aquarius-lock-zookeeper
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── nepxion
│ └── aquarius
│ └── lock
│ └── zookeeper
│ ├── condition
│ └── ZookeeperLockCondition.java
│ ├── configuration
│ └── ZookeeperLockConfiguration.java
│ └── impl
│ ├── ZookeeperLockDelegateImpl.java
│ └── ZookeeperLockExecutorImpl.java
├── aquarius-spring-boot-example
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── nepxion
│ │ └── aquarius
│ │ └── example
│ │ ├── adapter
│ │ └── RedissonAdapterImpl.java
│ │ ├── cache
│ │ ├── app1
│ │ │ └── CacheAopApplication.java
│ │ └── service
│ │ │ ├── MyService5.java
│ │ │ ├── MyService5Impl.java
│ │ │ └── MyService6Impl.java
│ │ ├── idgenerator
│ │ ├── app1
│ │ │ └── LocalIdGeneratorApplication.java
│ │ ├── app2
│ │ │ └── RedisIdGeneratorApplication.java
│ │ └── app3
│ │ │ └── ZookeeperIdGeneratorApplication.java
│ │ ├── limit
│ │ ├── app1
│ │ │ └── LimitAopApplication.java
│ │ ├── app2
│ │ │ └── LimitApplication.java
│ │ └── service
│ │ │ ├── MyService7.java
│ │ │ ├── MyService7Impl.java
│ │ │ └── MyService8Impl.java
│ │ └── lock
│ │ ├── app1
│ │ └── LockAopApplication.java
│ │ ├── app2
│ │ └── LockApplication.java
│ │ ├── app3
│ │ └── ReadWriteLockAopApplication.java
│ │ ├── app4
│ │ └── ReadWriteLockApplication.java
│ │ └── service
│ │ ├── MyService1.java
│ │ ├── MyService1Impl.java
│ │ ├── MyService2Impl.java
│ │ ├── MyService3.java
│ │ ├── MyService3Impl.java
│ │ └── MyService4Impl.java
│ └── resources
│ ├── application.properties
│ ├── logback.xml
│ └── redisson.yaml
├── aquarius-spring-cloud-example
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── nepxion
│ │ └── aquarius
│ │ └── example
│ │ ├── AquariusApplication.java
│ │ ├── cache
│ │ └── CacheAopController.java
│ │ ├── configuration
│ │ └── WebMvcConfiguration.java
│ │ ├── idgenerator
│ │ └── IdGeneratorController.java
│ │ ├── limit
│ │ ├── LimitAopController.java
│ │ └── LimitController.java
│ │ └── lock
│ │ ├── LockAopController.java
│ │ └── LockController.java
│ └── resources
│ ├── application.properties
│ ├── logback.xml
│ └── redisson.yaml
├── deploy.bat
├── pmd.xml
├── pom.xml
└── version.bat
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Declare files that will always have UNIX line endings on checkout.
2 | *.sh text eol=lf
--------------------------------------------------------------------------------
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # General configuration
2 | # Number of days of inactivity before an issue becomes stale
3 | daysUntilStale: 60
4 | # Issues with these labels will never be considered stale
5 | exemptLabels:
6 | - good first issue
7 | - contribution welcome
8 | - bug
9 | - discussion
10 | - enhancement
11 | - feature
12 | - feature request
13 | - help wanted
14 | - info
15 | - need investigation
16 | - tips
17 |
18 | # Set to true to ignore issues in a project (defaults to false)
19 | exemptProjects: true
20 | # Set to true to ignore issues in a milestone (defaults to false)
21 | exemptMilestones: true
22 | # Set to true to ignore issues with an assignee (defaults to false)
23 | exemptAssignees: true
24 | # Label to use when marking an issue as stale
25 | staleLabel: stale
26 |
27 | # Pull request specific configuration
28 | pulls:
29 | # Number of days of inactivity before a stale Issue or Pull Request is closed.
30 | # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
31 | daysUntilClose: 30
32 | # Comment to post when marking as stale. Set to `false` to disable
33 | markComment: >
34 | This pull request has been automatically marked as stale because it has not had activity
35 | in the last 90 days. It will be closed in 30 days if no further activity occurs. Please
36 | feel free to give a status update now, ping for review, or re-open when it's ready.
37 | Thank you for your contributions!
38 | # Comment to post when closing a stale Issue or Pull Request.
39 | closeComment: >
40 | This pull request has been automatically closed because it has not had
41 | activity in the last 30 days. Please feel free to give a status update now, ping for review, or re-open when it's ready.
42 | Thank you for your contributions!
43 | # Limit the number of actions per hour, from 1-30. Default is 30
44 | limitPerRun: 1
45 |
46 | # Issue specific configuration
47 | issues:
48 | # Number of days of inactivity before a stale Issue or Pull Request is closed.
49 | daysUntilClose: 14
50 | # Comment to post when marking as stale. Set to `false` to disable
51 | markComment: >
52 | This issue has been automatically marked as stale because it has not had activity in the
53 | last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity
54 | occurs. Thank you for your contributions.
55 | # Comment to post when closing a stale Issue or Pull Request.
56 | closeComment: >
57 | This issue has been automatically closed because it has not had activity in the
58 | last 14 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted".
59 | Thank you for your contributions.
60 | # Limit the number of actions per hour, from 1-30. Default is 30
61 | limitPerRun: 1
--------------------------------------------------------------------------------
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Maven
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3 |
4 | name: build
5 |
6 | on:
7 | push:
8 | branches: [ master ]
9 | pull_request:
10 | branches: [ master ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v2
19 | - name: Set up JDK 8
20 | uses: actions/setup-java@v2
21 | with:
22 | java-version: '8'
23 | distribution: 'adopt'
24 | - name: Build with Maven
25 | run: mvn -B package --file pom.xml
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 | .classpath
4 | .springBeans
5 | .factorypath
6 | # Mobile Tools for Java (J2ME)
7 | .mtj.tmp/
8 |
9 | *.class
10 | *.classpath
11 | *.project
12 | *.springBeans
13 | bin/
14 | log/
15 | test-output/
16 |
17 | # Package Files #
18 | *.jar
19 | *.war
20 | *.ear
21 | *.zip
22 | *.tar.gz
23 | *.rar
24 | *.swp
25 | *.log
26 | *.ctxt
27 | # nodejs local modules
28 | .tags*
29 | .idea/
30 | *.iml
31 | .gradle/
32 | .settings/
33 | target/
34 | hs_err_pid*
--------------------------------------------------------------------------------
/aquarius-cache-aop/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import java.util.List; 13 | 14 | import org.aopalliance.intercept.MethodInvocation; 15 | 16 | public interface CacheDelegate { 17 | // 新增缓存 18 | Object invokeCacheable(MethodInvocation invocation, ListTitle: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import java.lang.annotation.Documented; 13 | import java.lang.annotation.ElementType; 14 | import java.lang.annotation.Inherited; 15 | import java.lang.annotation.Retention; 16 | import java.lang.annotation.RetentionPolicy; 17 | import java.lang.annotation.Target; 18 | 19 | @Target({ ElementType.METHOD, ElementType.TYPE }) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @Inherited 22 | @Documented 23 | public @interface CacheEvict { 24 | /** 25 | * 缓存名字 26 | * @return String 27 | */ 28 | String name() default ""; 29 | 30 | /** 31 | * 缓存Key 32 | * @return String[] 33 | */ 34 | String[] key() default {}; 35 | 36 | /** 37 | * 是否全部清除缓存内容 38 | * @return boolean 39 | */ 40 | boolean allEntries() default false; 41 | 42 | /** 43 | * 缓存清理是在方法调用前还是调用后 44 | * @return boolean 45 | */ 46 | boolean beforeInvocation() default false; 47 | } -------------------------------------------------------------------------------- /aquarius-cache-aop/src/main/java/com/nepxion/aquarius/cache/annotation/CachePut.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.annotation; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import java.lang.annotation.Documented; 13 | import java.lang.annotation.ElementType; 14 | import java.lang.annotation.Inherited; 15 | import java.lang.annotation.Retention; 16 | import java.lang.annotation.RetentionPolicy; 17 | import java.lang.annotation.Target; 18 | 19 | @Target({ ElementType.METHOD, ElementType.TYPE }) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @Inherited 22 | @Documented 23 | public @interface CachePut { 24 | /** 25 | * 缓存名字 26 | * @return String 27 | */ 28 | String name() default ""; 29 | 30 | /** 31 | * 缓存Key 32 | * @return String[] 33 | */ 34 | String[] key() default {}; 35 | 36 | /** 37 | * 过期时间 38 | * 单位毫秒 39 | * @return long 40 | */ 41 | long expire() default -1234567890L; 42 | } -------------------------------------------------------------------------------- /aquarius-cache-aop/src/main/java/com/nepxion/aquarius/cache/annotation/Cacheable.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.annotation; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import java.lang.annotation.Documented; 13 | import java.lang.annotation.ElementType; 14 | import java.lang.annotation.Inherited; 15 | import java.lang.annotation.Retention; 16 | import java.lang.annotation.RetentionPolicy; 17 | import java.lang.annotation.Target; 18 | 19 | @Target({ ElementType.METHOD, ElementType.TYPE }) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @Inherited 22 | @Documented 23 | public @interface Cacheable { 24 | /** 25 | * 缓存名字 26 | * @return String 27 | */ 28 | String name() default ""; 29 | 30 | /** 31 | * 缓存Key 32 | * @return String[] 33 | */ 34 | String[] key() default {}; 35 | 36 | /** 37 | * 过期时间 38 | * 单位毫秒 39 | * @return long 40 | */ 41 | long expire() default -1234567890L; 42 | } -------------------------------------------------------------------------------- /aquarius-cache-aop/src/main/java/com/nepxion/aquarius/cache/aop/CacheAutoScanProxy.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.aop; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import java.lang.annotation.Annotation; 13 | 14 | import com.nepxion.aquarius.cache.annotation.CacheEvict; 15 | import com.nepxion.aquarius.cache.annotation.CachePut; 16 | import com.nepxion.aquarius.cache.annotation.Cacheable; 17 | import com.nepxion.matrix.proxy.aop.DefaultAutoScanProxy; 18 | import com.nepxion.matrix.proxy.mode.ProxyMode; 19 | import com.nepxion.matrix.proxy.mode.ScanMode; 20 | 21 | public class CacheAutoScanProxy extends DefaultAutoScanProxy { 22 | private static final long serialVersionUID = 5099476398968133135L; 23 | 24 | private String[] commonInterceptorNames; 25 | 26 | @SuppressWarnings("rawtypes") 27 | private Class[] methodAnnotations; 28 | 29 | public CacheAutoScanProxy(String scanPackages) { 30 | super(scanPackages, ProxyMode.BY_METHOD_ANNOTATION_ONLY, ScanMode.FOR_METHOD_ANNOTATION_ONLY); 31 | } 32 | 33 | @Override 34 | protected String[] getCommonInterceptorNames() { 35 | if (commonInterceptorNames == null) { 36 | commonInterceptorNames = new String[] { "cacheInterceptor" }; 37 | } 38 | 39 | return commonInterceptorNames; 40 | } 41 | 42 | @SuppressWarnings("unchecked") 43 | @Override 44 | protected Class extends Annotation>[] getMethodAnnotations() { 45 | if (methodAnnotations == null) { 46 | methodAnnotations = new Class[] { Cacheable.class, CachePut.class, CacheEvict.class }; 47 | } 48 | 49 | return methodAnnotations; 50 | } 51 | } -------------------------------------------------------------------------------- /aquarius-cache-aop/src/main/java/com/nepxion/aquarius/cache/configuration/CacheAopConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.configuration; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.beans.factory.annotation.Value; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | 16 | import com.nepxion.aquarius.cache.aop.CacheAutoScanProxy; 17 | import com.nepxion.aquarius.cache.aop.CacheInterceptor; 18 | import com.nepxion.aquarius.cache.constant.CacheConstant; 19 | 20 | @Configuration 21 | public class CacheAopConfiguration { 22 | @Value("${" + CacheConstant.CACHE_SCAN_PACKAGES + ":}") 23 | private String scanPackages; 24 | 25 | @Bean 26 | public CacheAutoScanProxy cacheAutoScanProxy() { 27 | return new CacheAutoScanProxy(scanPackages); 28 | } 29 | 30 | @Bean 31 | public CacheInterceptor cacheInterceptor() { 32 | return new CacheInterceptor(); 33 | } 34 | } -------------------------------------------------------------------------------- /aquarius-cache-aop/src/main/java/com/nepxion/aquarius/cache/constant/CacheConstant.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.constant; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | public class CacheConstant { 13 | public static final String CACHE_ENABLED = "cache.enabled"; 14 | 15 | public static final String CACHE_TYPE = "cache.type"; 16 | 17 | public static final String CACHE_TYPE_REDIS = "redisCache"; 18 | 19 | public static final String CACHE_AOP_EXCEPTION_IGNORE = "cache.aop.exception.ignore"; 20 | 21 | public static final String CACHE_EXPIRE = "cache.expire"; 22 | 23 | public static final String CACHE_SCAN_PACKAGES = "cache.scan.packages"; 24 | } -------------------------------------------------------------------------------- /aquarius-cache-redis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 |Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import com.nepxion.aquarius.cache.constant.CacheConstant; 13 | import com.nepxion.aquarius.common.condition.AquariusCondition; 14 | 15 | public class RedisCacheCondition extends AquariusCondition { 16 | public RedisCacheCondition() { 17 | super(CacheConstant.CACHE_TYPE, CacheConstant.CACHE_TYPE_REDIS); 18 | } 19 | } -------------------------------------------------------------------------------- /aquarius-cache-redis/src/main/java/com/nepxion/aquarius/cache/redis/configuration/RedisCacheConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.redis.configuration; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Conditional; 15 | import org.springframework.context.annotation.Configuration; 16 | import org.springframework.context.annotation.Import; 17 | 18 | import com.nepxion.aquarius.cache.CacheDelegate; 19 | import com.nepxion.aquarius.cache.redis.condition.RedisCacheCondition; 20 | import com.nepxion.aquarius.cache.redis.impl.RedisCacheDelegateImpl; 21 | import com.nepxion.aquarius.common.redis.configuration.RedisConfiguration; 22 | import com.nepxion.aquarius.common.redis.handler.RedisHandler; 23 | import com.nepxion.aquarius.common.redis.handler.RedisHandlerImpl; 24 | 25 | @Configuration 26 | @Import({ RedisConfiguration.class }) 27 | public class RedisCacheConfiguration { 28 | @Bean 29 | @Conditional(RedisCacheCondition.class) 30 | public CacheDelegate redisCacheDelegate() { 31 | return new RedisCacheDelegateImpl(); 32 | } 33 | 34 | @Bean 35 | @Conditional(RedisCacheCondition.class) 36 | @ConditionalOnMissingBean 37 | public RedisHandler redisHandler() { 38 | return new RedisHandlerImpl(); 39 | } 40 | } -------------------------------------------------------------------------------- /aquarius-cache-redis/src/main/java/com/nepxion/aquarius/cache/redis/configuration/RedissonCacheConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.redis.configuration; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.beans.factory.annotation.Value; 14 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 15 | import org.springframework.context.annotation.Bean; 16 | import org.springframework.context.annotation.Conditional; 17 | import org.springframework.context.annotation.Configuration; 18 | 19 | import com.nepxion.aquarius.cache.CacheDelegate; 20 | import com.nepxion.aquarius.cache.redis.condition.RedisCacheCondition; 21 | import com.nepxion.aquarius.cache.redis.impl.RedissonCacheDelegateImpl; 22 | import com.nepxion.aquarius.common.redisson.adapter.RedissonAdapter; 23 | import com.nepxion.aquarius.common.redisson.constant.RedissonConstant; 24 | import com.nepxion.aquarius.common.redisson.handler.RedissonHandler; 25 | import com.nepxion.aquarius.common.redisson.handler.RedissonHandlerImpl; 26 | 27 | @Configuration 28 | public class RedissonCacheConfiguration { 29 | @Value("${" + RedissonConstant.PATH + ":" + RedissonConstant.DEFAULT_PATH + "}") 30 | private String redissonPath; 31 | 32 | @Autowired(required = false) 33 | private RedissonAdapter redissonAdapter; 34 | 35 | @Bean 36 | @Conditional(RedisCacheCondition.class) 37 | public CacheDelegate redisCacheDelegate() { 38 | return new RedissonCacheDelegateImpl(); 39 | } 40 | 41 | @Bean 42 | @Conditional(RedisCacheCondition.class) 43 | @ConditionalOnMissingBean 44 | public RedissonHandler redissonHandler() { 45 | if (redissonAdapter != null) { 46 | return redissonAdapter.getRedissonHandler(); 47 | } 48 | 49 | return new RedissonHandlerImpl(redissonPath); 50 | } 51 | } -------------------------------------------------------------------------------- /aquarius-cache-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 |Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import java.lang.annotation.Documented; 13 | import java.lang.annotation.ElementType; 14 | import java.lang.annotation.Inherited; 15 | import java.lang.annotation.Retention; 16 | import java.lang.annotation.RetentionPolicy; 17 | import java.lang.annotation.Target; 18 | 19 | import org.springframework.context.annotation.Import; 20 | 21 | import com.nepxion.aquarius.cache.aop.CacheImportSelector; 22 | 23 | @Target(ElementType.TYPE) 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @Documented 26 | @Inherited 27 | @Import(CacheImportSelector.class) 28 | public @interface EnableCache { 29 | 30 | } -------------------------------------------------------------------------------- /aquarius-cache-starter/src/main/java/com/nepxion/aquarius/cache/aop/CacheImportSelector.java: -------------------------------------------------------------------------------- 1 | package com.nepxion.aquarius.cache.aop; 2 | 3 | /** 4 | *Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.core.Ordered; 13 | import org.springframework.core.annotation.Order; 14 | 15 | import com.nepxion.aquarius.cache.annotation.EnableCache; 16 | import com.nepxion.aquarius.cache.constant.CacheConstant; 17 | import com.nepxion.matrix.selector.AbstractImportSelector; 18 | import com.nepxion.matrix.selector.RelaxedPropertyResolver; 19 | 20 | @Order(Ordered.LOWEST_PRECEDENCE - 100) 21 | public class CacheImportSelector extends AbstractImportSelectorTitle: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.springframework.context.annotation.Configuration; 13 | import org.springframework.context.annotation.Import; 14 | 15 | import com.nepxion.aquarius.cache.configuration.CacheAopConfiguration; 16 | import com.nepxion.aquarius.cache.redis.configuration.RedisCacheConfiguration; 17 | import com.nepxion.aquarius.common.configuration.AquariusConfiguration; 18 | 19 | @Configuration 20 | @Import({ AquariusConfiguration.class, CacheAopConfiguration.class, RedisCacheConfiguration.class }) 21 | public class CacheConfiguration { 22 | 23 | } -------------------------------------------------------------------------------- /aquarius-cache-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | com.nepxion.aquarius.cache.annotation.EnableCache=\ 2 | com.nepxion.aquarius.cache.configuration.CacheConfiguration -------------------------------------------------------------------------------- /aquarius-common-redis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 |Title: Nepxion Aquarius
5 | *Description: Nepxion Aquarius
6 | *Copyright: Copyright (c) 2017-2050
7 | *Company: Nepxion
8 | * @author Haojun Ren 9 | * @version 1.0 10 | */ 11 | 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 15 | import org.springframework.context.annotation.Bean; 16 | import org.springframework.context.annotation.Configuration; 17 | import org.springframework.data.redis.connection.RedisConnectionFactory; 18 | import org.springframework.data.redis.core.RedisTemplate; 19 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 20 | import org.springframework.data.redis.serializer.StringRedisSerializer; 21 | 22 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; 23 | import com.fasterxml.jackson.annotation.PropertyAccessor; 24 | import com.fasterxml.jackson.databind.ObjectMapper; 25 | 26 | @Configuration 27 | public class RedisConfiguration { 28 | private static final Logger LOG = LoggerFactory.getLogger(RedisConfiguration.class); 29 | 30 | @Bean 31 | @ConditionalOnMissingBean 32 | public RedisTemplate