Renamed service, renamed property

This commit is contained in:
Denis Kazantsev 2022-04-08 19:33:24 +03:00
parent 8b39e59c46
commit b7a000e2ab
4 changed files with 12 additions and 11 deletions

View File

@ -7,11 +7,11 @@ import org.springframework.http.server.ServerHttpRequest
import org.springframework.http.server.ServerHttpResponse
import org.springframework.web.bind.annotation.RestControllerAdvice
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
import ru.touchin.server.info.services.ServerInfoService
import ru.touchin.server.info.services.ServerInfoHeader
@RestControllerAdvice
class ServerInfoAdvice(
private val serverInfoService: List<ServerInfoService>
private val serverInfoHeaders: List<ServerInfoHeader>
) : ResponseBodyAdvice<Any> {
override fun supports(
@ -29,7 +29,7 @@ class ServerInfoAdvice(
request: ServerHttpRequest,
response: ServerHttpResponse
): Any? {
for (service in serverInfoService) {
for (service in serverInfoHeaders) {
response
.headers
.addAll(

View File

@ -2,7 +2,7 @@ package ru.touchin.server.info.services
import org.springframework.util.MultiValueMap
interface ServerInfoService {
interface ServerInfoHeader {
fun getHeaders(): MultiValueMap<String, String>

View File

@ -1,15 +1,15 @@
package ru.touchin.server.info.services.version
import org.springframework.stereotype.Service
import org.springframework.stereotype.Component
import org.springframework.util.LinkedMultiValueMap
import org.springframework.util.MultiValueMap
import ru.touchin.server.info.services.version.properties.ServerInfoProperties
import ru.touchin.server.info.services.ServerInfoService
import ru.touchin.server.info.services.ServerInfoHeader
@Service
class BuildVersionServiceImpl(
@Component
class BuildVersionHeader(
private val serverInfoProperties: ServerInfoProperties
) : ServerInfoService {
) : ServerInfoHeader {
override fun getHeaders(): MultiValueMap<String, String> {
return LinkedMultiValueMap<String, String>()

View File

@ -1,2 +1,3 @@
server.info:
buildVersion: 1
server:
info:
buildVersion: 1