This commit is contained in:
ialbert 2022-10-27 12:27:48 +03:00
parent 03a7f1056a
commit f9c512373e
4 changed files with 77 additions and 0 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ target
logs
tmp_notes.**
tmp
clearing-parent/backend-api/src/main/resources/meta.json

View file

@ -132,6 +132,30 @@
</transformationSets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-meta</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/generated-resources/xml/xslt</directory>
<includes>
<include>meta.json</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,21 @@
package ru.spcex.clearing.backendapi.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.nio.file.Files;
@Configuration
public class MetaConfiguration {
@Value("file:${spring.config.location}/meta.json")
private Resource meta;
@Bean("metaJson")
public String metaJsonConfiguration() throws IOException {
if (!meta.isReadable()) throw new IllegalStateException("cannot read keycloak.json settings from spring.config.location");
return Files.readString(meta.getFile().toPath());
}
}

View file

@ -0,0 +1,31 @@
package ru.spcex.clearing.backendapi.controller.system;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/meta")
public class MetaController {
private final String metaRawJson;
@Autowired
public MetaController(@Qualifier("metaJson") String meta) {
this.metaRawJson = meta;
}
@ApiOperation(value = "get meta.json")
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK" /*response = DictionaryBackendGetAll.class*/)})
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public String getAll() {
return metaRawJson;
}
}