File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed
problem-spring-web-autoconfigure
main/java/org/zalando/problem/spring/web/autoconfigure/security
test/java/org/zalando/problem/spring/web/autoconfigure/security Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 6363 <version >${spring-security.version} </version >
6464 <optional >true</optional >
6565 </dependency >
66-
6766 <dependency >
6867 <groupId >org.zalando</groupId >
6968 <artifactId >problem-spring-web</artifactId >
7069 <version >${project.version} </version >
7170 <optional >true</optional >
7271 </dependency >
72+ <dependency >
73+ <groupId >org.springframework.boot</groupId >
74+ <artifactId >spring-boot-starter-test</artifactId >
75+ <version >${spring-boot.version} </version >
76+ <scope >test</scope >
77+ <exclusions >
78+ <exclusion >
79+ <groupId >org.hamcrest</groupId >
80+ <artifactId >java-hamcrest</artifactId >
81+ </exclusion >
82+ <exclusion >
83+ <groupId >ch.qos.logback</groupId >
84+ <artifactId >logback-classic</artifactId >
85+ </exclusion >
86+ </exclusions >
87+ </dependency >
7388 </dependencies >
7489</project >
Original file line number Diff line number Diff line change 22
33import org .springframework .beans .factory .annotation .Autowired ;
44import org .springframework .boot .autoconfigure .condition .ConditionalOnClass ;
5+ import org .springframework .boot .autoconfigure .condition .ConditionalOnWebApplication ;
56import org .springframework .context .annotation .Configuration ;
67import org .springframework .context .annotation .Import ;
78import org .springframework .core .Ordered ;
1415 * Registers exception handling in spring-security
1516 */
1617@ Configuration
18+ @ ConditionalOnWebApplication
1719@ ConditionalOnClass (WebSecurityConfigurerAdapter .class ) //only when spring-security is in classpath
1820@ Import (SecurityProblemSupport .class )
1921@ Order (Ordered .LOWEST_PRECEDENCE - 21 ) //subtract random, uncommon number to reduce chances of collision with a user-selected order
Original file line number Diff line number Diff line change 1+ package org .zalando .problem .spring .web .autoconfigure .security ;
2+
3+ import static org .assertj .core .api .Assertions .assertThat ;
4+ import org .junit .jupiter .api .Test ;
5+ import org .springframework .beans .factory .annotation .Autowired ;
6+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
7+ import org .springframework .boot .test .context .SpringBootTest ;
8+ import org .springframework .context .ApplicationContext ;
9+
10+ @ SpringBootTest ("spring.main.web-application-type=none" )
11+ final class SecurityConfigurationTest {
12+
13+ @ Test
14+ void contextLoads (@ Autowired ApplicationContext context ) {
15+ assertThat (context ).isNotNull ();
16+ }
17+
18+ @ SpringBootApplication
19+ static class TestApplication {
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments