This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/3.x by this push:
new 1a4a48a76 added spring-boot module
1a4a48a76 is described below
commit 1a4a48a76e565b3c4cd4637b32ffd33456c1a628
Author: lprimak <[email protected]>
AuthorDate: Tue Feb 3 10:14:39 2026 -0600
added spring-boot module
---
.../shiro/event/support/DefaultEventBus.java | 13 ++-
pom.xml | 2 +-
support/pom.xml | 2 +-
support/spring-boot/pom.xml | 92 ++++++++++++++++++++--
.../ShiroEnvironmentPostProcessor.java | 2 +-
.../ShiroWebMvcAutoConfiguration.java | 3 -
.../src/main/resources/META-INF/spring.factories | 2 +-
.../web/filter/mgt/DefaultFilterChainManager.java | 8 +-
8 files changed, 107 insertions(+), 17 deletions(-)
diff --git
a/event/src/main/java/org/apache/shiro/event/support/DefaultEventBus.java
b/event/src/main/java/org/apache/shiro/event/support/DefaultEventBus.java
index 4a62590d7..a9e036c37 100644
--- a/event/src/main/java/org/apache/shiro/event/support/DefaultEventBus.java
+++ b/event/src/main/java/org/apache/shiro/event/support/DefaultEventBus.java
@@ -95,14 +95,14 @@ public class DefaultEventBus implements EventBus {
//and the lock provides thread-safety in probably a much simpler mechanism
than attempting to write a
//EventBus-specific Comparator. This technique is also likely to be
faster than a ConcurrentSkipListMap, which
//is about 3-5 times slower than a standard ConcurrentMap.
- final Map<Object, Subscription> registry;
+ private final Map<Object, Subscription> registry;
private final Lock registryReadLock;
private final Lock registryWriteLock;
private EventListenerResolver eventListenerResolver;
public DefaultEventBus() {
//not thread safe, so we need locks:
- this.registry = new LinkedHashMap<Object, Subscription>();
+ this.registry = new LinkedHashMap<>();
ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
this.registryReadLock = rwl.readLock();
this.registryWriteLock = rwl.writeLock();
@@ -117,6 +117,15 @@ public class DefaultEventBus implements EventBus {
this.eventListenerResolver = eventListenerResolver;
}
+ public Map<Object, Subscription> getRegistry() {
+ registryReadLock.lock();
+ try {
+ return Map.copyOf(registry);
+ } finally {
+ registryReadLock.unlock();
+ }
+ }
+
public void publish(Object event) {
if (event == null) {
LOGGER.info("Received null event for publishing. Ignoring and
returning.");
diff --git a/pom.xml b/pom.xml
index bdf28186c..2d3eebc35 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,7 +116,7 @@
<slf4j.version>2.0.17</slf4j.version>
<log4j.version>2.25.3</log4j.version>
<spring.version>7.0.3</spring.version>
- <spring-boot.version>4.0.1</spring-boot.version>
+ <spring-boot.version>4.0.2</spring-boot.version>
<guice.version>7.0.0</guice.version>
<jaxrs.api.version>4.0.0</jaxrs.api.version>
<htmlunit.version>4.21.0</htmlunit.version>
diff --git a/support/pom.xml b/support/pom.xml
index 1c78ce0b3..a2ede9365 100644
--- a/support/pom.xml
+++ b/support/pom.xml
@@ -43,13 +43,13 @@
<module>cdi</module>
<module>jakarta-ee</module>
<module>spring</module>
+ <module>spring-boot</module>
</modules>
<profiles>
<profile>
<id>deferred-for-3x</id>
<modules>
- <module>spring-boot</module>
<module>features</module>
</modules>
</profile>
diff --git a/support/spring-boot/pom.xml b/support/spring-boot/pom.xml
index e7e8c8060..038dfbe89 100644
--- a/support/spring-boot/pom.xml
+++ b/support/spring-boot/pom.xml
@@ -36,21 +36,17 @@
<module>spring-boot-web-starter</module>
</modules>
- <properties>
- <junit.engine.version>6.0.2</junit.engine.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
- <version>${junit.engine.version}</version>
+ <version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
- <version>${junit.engine.version}</version>
+ <version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -76,6 +72,90 @@
<groupId>org.junit.vintage</groupId>
<artifactId>*</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>jakarta.ws.rs</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.json</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.json.bind</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.interceptor</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.servlet</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.data</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.el</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.websocket</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.transaction</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.persistence</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.validation</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.activation</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.authentication</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.authorization</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.mail</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.resource</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.servlet.jsp.jstl</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jakarta.jms</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<!--
diff --git
a/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroEnvironmentPostProcessor.java
b/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroEnvironmentPostProcessor.java
index b43f49654..94d161fa3 100644
---
a/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroEnvironmentPostProcessor.java
+++
b/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroEnvironmentPostProcessor.java
@@ -18,8 +18,8 @@
*/
package org.apache.shiro.spring.config.web.autoconfigure;
+import org.springframework.boot.EnvironmentPostProcessor;
import org.springframework.boot.SpringApplication;
-import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;
diff --git
a/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroWebMvcAutoConfiguration.java
b/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroWebMvcAutoConfiguration.java
index 098228d94..73090ad49 100644
---
a/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroWebMvcAutoConfiguration.java
+++
b/support/spring-boot/spring-boot-starter/src/main/java/org/apache/shiro/spring/config/web/autoconfigure/ShiroWebMvcAutoConfiguration.java
@@ -18,17 +18,14 @@
*/
package org.apache.shiro.spring.config.web.autoconfigure;
-import org.apache.shiro.spring.web.config.ShiroRequestMappingConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
import
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
@Configuration
@ConditionalOnClass(RequestMappingHandlerMapping.class)
-@Import(ShiroRequestMappingConfig.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@ConditionalOnProperty(name = "shiro.web.enabled", matchIfMissing = true)
public class ShiroWebMvcAutoConfiguration {
diff --git
a/support/spring-boot/spring-boot-starter/src/main/resources/META-INF/spring.factories
b/support/spring-boot/spring-boot-starter/src/main/resources/META-INF/spring.factories
index c7f367c86..1fdd41431 100644
---
a/support/spring-boot/spring-boot-starter/src/main/resources/META-INF/spring.factories
+++
b/support/spring-boot/spring-boot-starter/src/main/resources/META-INF/spring.factories
@@ -1,5 +1,5 @@
org.springframework.boot.diagnostics.FailureAnalyzer = \
org.apache.shiro.spring.boot.autoconfigure.ShiroNoRealmConfiguredFailureAnalyzer
-org.springframework.boot.env.EnvironmentPostProcessor=\
+org.springframework.boot.EnvironmentPostProcessor=\
org.apache.shiro.spring.config.web.autoconfigure.ShiroEnvironmentPostProcessor
diff --git
a/web/src/main/java/org/apache/shiro/web/filter/mgt/DefaultFilterChainManager.java
b/web/src/main/java/org/apache/shiro/web/filter/mgt/DefaultFilterChainManager.java
index c7797eb88..ae679e8d4 100644
---
a/web/src/main/java/org/apache/shiro/web/filter/mgt/DefaultFilterChainManager.java
+++
b/web/src/main/java/org/apache/shiro/web/filter/mgt/DefaultFilterChainManager.java
@@ -59,7 +59,7 @@ public class DefaultFilterChainManager implements
FilterChainManager {
/**
* list of filters to prepend to every chain
*/
- private List<String> globalFilterNames;
+ private final List<String> globalFilterNames;
/**
* key: chain name, value: chain
@@ -160,7 +160,7 @@ public class DefaultFilterChainManager implements
FilterChainManager {
// first add each of global filters
if (!CollectionUtils.isEmpty(globalFilterNames)) {
- globalFilterNames.stream().forEach(filterName ->
addToChain(chainName, filterName));
+ globalFilterNames.forEach(filterName -> addToChain(chainName,
filterName));
}
//parse the value by tokenizing it to get the resulting
filter-specific config entries
@@ -311,6 +311,10 @@ public class DefaultFilterChainManager implements
FilterChainManager {
chain.add(filter);
}
+ public List<String> getGlobalFilterNames() {
+ return List.copyOf(globalFilterNames);
+ }
+
public void setGlobalFilters(List<String> globalFilterNames) throws
ConfigurationException {
// validate each filter name
if (!CollectionUtils.isEmpty(globalFilterNames)) {