package gaf3.core.services

import gaf3.core.cloud.GafCloudConfiguration
import gaf3.core.data.PagedData
import gaf3.core.services.api.UserService
import gaf3.core.services.api.domain.UserInfo
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.cloud.openfeign.EnableFeignClients
import org.springframework.context.annotation.Import
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@SpringBootApplication
@RestController
@EnableFeignClients
@Import(GafCloudConfiguration::class)
class ServiceApiApplication {

	@Autowired
	var service: UserService? = null

	@RequestMapping("/demo")
	fun demo() : PagedData<UserInfo>? {
		return this.service?.findUsers()
	}
}

fun main(args: Array<String>) {
	runApplication<ServiceApiApplication>(*args)
}
