In Spring Security to mimic the behavior of multiple <http>
elements from XML in Java config create multiple classes for security configuration. In general it is the best/easiest to create a common security configuration with multiple inner classes for the security definition for HttpSecurity
. See here for a sample.
And here the related section in the official Spring Security documentation:
5.7 Multiple HttpSecurity