This commit is contained in:
pavel 2026-02-03 01:11:34 +01:00
commit b38bffe86e
15 changed files with 590 additions and 0 deletions

View file

@ -0,0 +1,15 @@
package com.example.demo
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
@SpringBootApplication
class Application
fun main(args: Array<String>) {
runApplication<Application>(*args)
}

View file

@ -0,0 +1,16 @@
package com.example.demo
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.web.SecurityFilterChain
@Profile("local")
@Configuration
class SecurityConfig {
@Bean
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain =
http.authorizeHttpRequests { it.anyRequest().permitAll() }.csrf { it.disable() }.build()
}

View file

@ -0,0 +1,19 @@
package com.example.demo.api
import com.example.demo.service.HelloService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/public")
class HelloController(
private val helloService: HelloService
) {
@GetMapping("/test")
fun hello() = helloService.findHello()
@PostMapping("/test")
fun createHello() = helloService.addHello()
}

View file

@ -0,0 +1,20 @@
package com.example.demo.service
import com.example.jooq.Tables
import org.jooq.DSLContext
import org.springframework.stereotype.Service
@Service
class HelloService(
private val dslContext: DSLContext
) {
fun findHello(): String {
val test = dslContext.select().from(Tables.HELLO).fetchOne { it[Tables.HELLO.HELLO_] as String }
return test ?: "no hello found"
}
fun addHello() {
dslContext.insertInto(Tables.HELLO).set(Tables.HELLO.HELLO_, "Hello World!!").execute()
}
}

View file

@ -0,0 +1,13 @@
spring:
application:
name: demo
datasource:
url: jdbc:postgresql://localhost:5432/postgres?useSSL=false&serverTimezone=UTC
username: postgres
password: postgres
threads:
virtual:
enabled: true
server:
port: 8081

View file

@ -0,0 +1,20 @@
databaseChangeLog:
- changeSet:
id: 1
author: whocares
changes:
- createTable:
tableName: hello
columns:
- column:
name: id
type: int
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: hello
type: varchar(50)
constraints:
nullable: false

View file

@ -0,0 +1,13 @@
package com.example.demo
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
class AppTests {
@Test
fun contextLoads() {
}
}