Skip to content

Commit cfff8d5

Browse files
authored
Adjust When Spring Security is Loaded (#500)
By Placing it as part of the Servlet Config, it isn't loaded via a programmatic listener by Spring, thus allowing it to use the ServletRegistration API. While the 6.2 release addresses this by deferring those checks til runtime, having them available at startup will provide a performance benefit as well as the benefit of knowing at startup time if there is an insecure configuration to be corrected. Related to spring-projects/spring-security#13794
1 parent bc76dbd commit cfff8d5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mvc-freemarker/src/main/java/com/example/demo/DemoApplicationInitializer.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,18 @@ public class DemoApplicationInitializer extends AbstractAnnotationConfigDispatch
1414

1515
@Override
1616
protected Class<?>[] getRootConfigClasses() {
17+
return null;
18+
}
19+
20+
@Override
21+
protected Class<?>[] getServletConfigClasses() {
1722
return new Class[]{
1823
AppConfig.class,
1924
Jackson2ObjectMapperConfig.class,
2025
DataSourceConfig.class,
2126
DataJdbcConfig.class,
2227
JdbcConfig.class,
23-
SecurityConfig.class
24-
};
25-
}
26-
27-
@Override
28-
protected Class<?>[] getServletConfigClasses() {
29-
return new Class[]{
28+
SecurityConfig.class,
3029
WebConfig.class
3130
};
3231
}

0 commit comments

Comments
 (0)