Skip to content

Commit

Permalink
Merge pull request #293 from apache/single-spring-boot
Browse files Browse the repository at this point in the history
Combine Spring Boot starters (web and non-web) into single module
  • Loading branch information
bdemers authored May 27, 2021
2 parents 671f40f + ac00970 commit 5682cf6
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 128 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,11 @@
<artifactId>spring-boot-test</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
</dependency>

<!-- Guice -->
<dependency>
Expand Down
10 changes: 10 additions & 0 deletions support/spring-boot/spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -50,6 +51,7 @@
@Configuration
@AutoConfigureBefore(ShiroAutoConfiguration.class)
@AutoConfigureAfter(ShiroWebMvcAutoConfiguration.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@ConditionalOnProperty(name = "shiro.web.enabled", matchIfMissing = true)
public class ShiroWebAutoConfiguration extends AbstractShiroWebConfiguration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.shiro.web.servlet.AbstractShiroFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -34,6 +35,7 @@
* @since 1.4.0
*/
@Configuration
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@ConditionalOnProperty(name = "shiro.web.enabled", matchIfMissing = true)
public class ShiroWebFilterConfiguration extends AbstractShiroWebFilterConfiguration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
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 { }
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,42 @@
"type": "java.lang.Boolean",
"description": "A boolean flag that can disable all Shiro Spring Boot starters. This is mostly useful during testing or debugging, or if you want to compare behavior when Shiro is enabled or disabled.",
"defaultValue": true
},
{
"name": "shiro.web.enabled",
"type": "java.lang.Boolean",
"description": "A boolean flag that can disable all Shiro Spring Boot starters. This is mostly useful during testing or debugging, or if you want to compare behavior when Shiro is enabled or disabled.",
"defaultValue": true
},
{
"name": "shiro.loginUrl",
"type": "java.lang.String",
"description": "The application's login URL to be assigned to all acquired Filters that subclass AccessControlFilter or 'null' if no value should be assigned globally.",
"defaultValue": "/login.jsp"
},
{
"name": "shiro.successUrl",
"type": "java.lang.String",
"description": "The application's after-login success URL to be assigned to all acquired Filters that subclass AuthenticationFilter or null if no value should be assigned globally.",
"defaultValue": "/"
},
{
"name": "shiro.unauthorizedUrl",
"type": "java.lang.String",
"description": "The application's 'unauthorized' URL to apply to as a convenience to all discovered AuthorizationFilter instances.",
"defaultValue": null
},
{
"name": "shiro.sessionManager.sessionIdCookieEnabled",
"type": "java.lang.String",
"description": "Enable or disable session tracking via a cookie.",
"defaultValue": true
},
{
"name": "shiro.sessionManager.sessionIdUrlRewritingEnabled",
"type": "java.lang.String",
"description": "Enable or disable session tracking via a URL parameter. If your site requires cookies, it is recommended you disable this.",
"defaultValue": true
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration = \
org.apache.shiro.spring.config.web.autoconfigure.ShiroWebAutoConfiguration,\
org.apache.shiro.spring.config.web.autoconfigure.ShiroWebFilterConfiguration,\
org.apache.shiro.spring.config.web.autoconfigure.ShiroWebMvcAutoConfiguration,\
org.apache.shiro.spring.boot.autoconfigure.ShiroBeanAutoConfiguration,\
org.apache.shiro.spring.boot.autoconfigure.ShiroAutoConfiguration,\
org.apache.shiro.spring.boot.autoconfigure.ShiroAnnotationProcessorAutoConfiguration
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
provides: shiro
provides: shiro,shiro-web
19 changes: 0 additions & 19 deletions support/spring-boot/spring-boot-web-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,10 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 5682cf6

Please sign in to comment.