-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IS-96 Disabled Redisson autoconfiguration if Redis is not configured (#…
…97)
- Loading branch information
1 parent
bca53f3
commit fdd1e9d
Showing
14 changed files
with
115 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...wedenconnect/spring/saml/idp/autoconfigure/redis/RedissonActivationAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2023-2025 Sweden Connect | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package se.swedenconnect.spring.saml.idp.autoconfigure.redis; | ||
|
||
import org.redisson.Redisson; | ||
import org.redisson.spring.starter.RedissonAutoConfigurationV2; | ||
import org.redisson.spring.starter.RedissonProperties; | ||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.boot.autoconfigure.AutoConfigureBefore; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; | ||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.data.redis.core.RedisOperations; | ||
|
||
/** | ||
* Activates Redisson if Redis is configured and Redisson is in classpath. | ||
* | ||
* @author Martin Lindström | ||
*/ | ||
@AutoConfiguration | ||
@AutoConfigureBefore(RedisAutoConfiguration.class) | ||
@ConditionalOnProperty(prefix = "spring.data.redis", name = "host") | ||
@ConditionalOnClass({ Redisson.class, RedisOperations.class, RedissonAutoConfigurationV2.class }) | ||
@EnableConfigurationProperties({ RedissonProperties.class, RedisProperties.class }) | ||
public class RedissonActivationAutoConfiguration extends RedissonAutoConfigurationV2 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...re/src/main/java/se/swedenconnect/spring/saml/idp/autoconfigure/redis/RedissonFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2023-2025 Sweden Connect | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package se.swedenconnect.spring.saml.idp.autoconfigure.redis; | ||
|
||
import org.redisson.spring.starter.RedissonAutoConfigurationV2; | ||
import org.springframework.boot.autoconfigure.AutoConfigurationImportFilter; | ||
import org.springframework.boot.autoconfigure.AutoConfigurationMetadata; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Disables Redisson autoconfiguration. | ||
* | ||
* @author Martin Lindström | ||
*/ | ||
public class RedissonFilter implements AutoConfigurationImportFilter { | ||
|
||
public static final String DISABLE = RedissonAutoConfigurationV2.class.getName(); | ||
|
||
@Override | ||
public boolean[] match(final String[] autoConfigurationClasses, | ||
final AutoConfigurationMetadata autoConfigurationMetadata) { | ||
|
||
final boolean[] matches = new boolean[autoConfigurationClasses.length]; | ||
for (int i = 0; i < autoConfigurationClasses.length; i++) { | ||
matches[i] = !Objects.equals(DISABLE, autoConfigurationClasses[i]); | ||
} | ||
|
||
return matches; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.springframework.boot.autoconfigure.AutoConfigurationImportFilter=se.swedenconnect.spring.saml.idp.autoconfigure.redis.RedissonFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ server: | |
include-exception: true | ||
include-stacktrace: always | ||
|
||
|
||
management: | ||
server: | ||
port: 8444 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters