41 lines
1.3 KiB
Kotlin
41 lines
1.3 KiB
Kotlin
package com.example.demo
|
|
|
|
import com.example.lib.MyLib
|
|
import com.example.lib.MyUtils
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
import org.springframework.boot.CommandLineRunner
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
|
import org.springframework.boot.runApplication
|
|
import org.springframework.security.access.prepost.PreAuthorize
|
|
import org.springframework.security.core.Authentication
|
|
import org.springframework.web.bind.annotation.GetMapping
|
|
import org.springframework.web.bind.annotation.RequestMapping
|
|
import org.springframework.web.bind.annotation.RestController
|
|
|
|
@SpringBootApplication (scanBasePackages = ["com.example.demo", "com.example.loginapi","com.example.customerapi"])
|
|
class DemoApplication @Autowired constructor(
|
|
//customerRepository: CustomerRepository,
|
|
) : CommandLineRunner {
|
|
override fun run(vararg args: String?) {
|
|
MyLib.doOnMe()
|
|
|
|
println()
|
|
|
|
println("Hello JJKK: ${MyUtils.helloWorld()}")
|
|
}
|
|
}
|
|
|
|
fun main(args: Array<String>) {
|
|
runApplication<DemoApplication>(*args)
|
|
}
|
|
|
|
|
|
@RestController
|
|
@RequestMapping("/oauth")
|
|
@PreAuthorize("isAuthenticated()")
|
|
class OAuthController {
|
|
@GetMapping
|
|
fun getMe(authentication: Authentication) : Any? {
|
|
return authentication
|
|
}
|
|
} |