Hi, I’m trying to use the Kotlin DSL for spring se...
# spring
a
Hi, I’m trying to use the Kotlin DSL for spring security in spring boot 2.4.0 but everything inside the http block is unrecognised. I have included the spring-boot-starter-security dependency is there anything else I need to add to my pom?
Copy code
http {
            httpBasic {}
            authorizeRequests {
                authorize("/greetings/**", hasAuthority("ROLE_ADMIN"))
                authorize("/**", permitAll)
            }
        }
I have the following dependencies;
Copy code
<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-security</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.module</groupId>
			<artifactId>jackson-module-kotlin</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jetbrains.kotlin</groupId>
			<artifactId>kotlin-reflect</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jetbrains.kotlin</groupId>
			<artifactId>kotlin-stdlib-jdk8</artifactId>
		</dependency>
problem solved I was missing the following import.
Copy code
import org.springframework.security.config.web.servlet.invoke
No amount of prompting would force Intellij to import it for me.
s
Looks like https://youtrack.jetbrains.com/issue/KT-40926 please vote for it
👍🏻 1
r
Hi @andy.burdett May I know how did you come to know that this import needs to be added ?
128 Views