1 | package mk.ukim.finki.busngobackend
|
---|
2 |
|
---|
3 | import org.springframework.boot.autoconfigure.SpringBootApplication
|
---|
4 | import org.springframework.boot.runApplication
|
---|
5 | import org.springframework.context.annotation.Bean
|
---|
6 | import org.springframework.context.event.ApplicationEventMulticaster
|
---|
7 | import org.springframework.context.event.SimpleApplicationEventMulticaster
|
---|
8 | import org.springframework.core.task.SimpleAsyncTaskExecutor
|
---|
9 | import org.springframework.scheduling.annotation.EnableAsync
|
---|
10 | import org.springframework.scheduling.annotation.EnableScheduling
|
---|
11 | import org.springframework.security.crypto.password.NoOpPasswordEncoder
|
---|
12 | import org.springframework.security.crypto.password.PasswordEncoder
|
---|
13 |
|
---|
14 | @SpringBootApplication
|
---|
15 | @EnableAsync
|
---|
16 | @EnableScheduling
|
---|
17 | class BusNGoBackendApplication
|
---|
18 |
|
---|
19 | fun main(args: Array<String>) {
|
---|
20 | runApplication<BusNGoBackendApplication>(*args)
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Bean
|
---|
24 | fun encoder(): PasswordEncoder = NoOpPasswordEncoder.getInstance()
|
---|
25 | // object : PasswordEncoder {
|
---|
26 | // override fun encode(rawPassword: CharSequence?): String = rawPassword.toString()
|
---|
27 | //
|
---|
28 | // override fun matches(
|
---|
29 | // rawPassword: CharSequence?,
|
---|
30 | // encodedPassword: String?,
|
---|
31 | // ): Boolean = rawPassword != null && rawPassword.toString() == encodedPassword
|
---|
32 | // }
|
---|
33 |
|
---|
34 | @Bean
|
---|
35 | fun asyncEventPublisher(): ApplicationEventMulticaster {
|
---|
36 | val publisher = SimpleApplicationEventMulticaster()
|
---|
37 | publisher.setTaskExecutor(SimpleAsyncTaskExecutor())
|
---|
38 | return publisher
|
---|
39 | }
|
---|