This works in Spring Boot:
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Override
protected void configure (final HttpSecurity http) throws Exception
{
http
.csrf ()
.disable ()
.authorizeRequests ()
.antMatchers ("/public/**") .permitAll ()
...
This doesn't:
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Override
protected void configure (final HttpSecurity http) throws Exception
{
ExpressionInterceptUrlRegistry registry = http
.csrf ()
.disable ()
.authorizeRequests ();
registry.antMatchers ("/public/**") .permitAll ();
The compilation error is
cannot find symbol
symbol: method permitAll()
location: class java.lang.Object
When the chain of builder calls is split like this, antMatchers
returns Object
instead of ExpressionInterceptUrlRegistry
? Why?
Practical question: How do I store the builder object when a chain is half-built and continue it with subsequent calls?
Theory question: Why can't the compiler see the type?