generated from 2martens/template-service
Updated directory structure
This commit is contained in:
parent
ce00bd39ee
commit
ef60abc4f9
23
README.md
23
README.md
|
@ -1,28 +1,11 @@
|
||||||
# Instructions for using the template
|
# OParl Service
|
||||||
|
|
||||||
## Introduction
|
|
||||||
|
|
||||||
This template is based upon best practices and uses Spring Boot to implement
|
|
||||||
REST APIs.
|
|
||||||
|
|
||||||
## Steps
|
|
||||||
|
|
||||||
* clone the project and create a new repository
|
|
||||||
* replace all occurences of 'template' with your service name, 'Template' accordingly (mind the cases)
|
|
||||||
* import the project in your IDE
|
|
||||||
* run initial `gradlew build`
|
|
||||||
|
|
||||||
**============ // todo: Ab hier die Doku überprüfen und ggf. ergänzen ==========**
|
|
||||||
|
|
||||||
# Template
|
|
||||||
**// todo: Hier sollte das Projekt etwas beschrieben werden**
|
|
||||||
|
|
||||||
## Git
|
## Git
|
||||||
|
|
||||||
The repository of ... is located under https://git.2martens.de/2martens/template-service.git
|
The repository of the OParl service is located under https://git.2martens.de/2martens/oparl-service.git
|
||||||
|
|
||||||
It is partially encrypted with git-crypt and has to be decrypted first:
|
It is partially encrypted with git-crypt and has to be decrypted first:
|
||||||
```bash
|
```bash
|
||||||
git-crypt unlock %USERPROFILE%/.git-crypt-key
|
git-crypt unlock %USERPROFILE%/.my-git-crypt-key
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
projectname=template-service
|
projectname=oparl-service
|
||||||
projectgroup=de.twomartens
|
projectgroup=de.twomartens
|
||||||
projectSourceCompatibility=11
|
projectSourceCompatibility=11
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package de.twomartens.templateservice;
|
package de.twomartens.oparlservice;
|
||||||
|
|
||||||
import de.twomartens.templateservice.entity.Greeting;
|
import de.twomartens.oparlservice.entity.Greeting;
|
||||||
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
|
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
|
||||||
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
|
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -17,7 +17,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
|
||||||
|
|
||||||
@SpringJUnitConfig
|
@SpringJUnitConfig
|
||||||
@SpringBootTest(webEnvironment = RANDOM_PORT)
|
@SpringBootTest(webEnvironment = RANDOM_PORT)
|
||||||
class TemplateServiceRestTests {
|
class OParlServiceRestTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.twomartens.templateservice;
|
package de.twomartens.oparlservice;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
@ -10,20 +10,20 @@ import java.util.Optional;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
public class TemplateServiceApplication {
|
public class OParlServiceApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
log.info(">>> {}:{} <<<", getTitle(), getVersion());
|
log.info(">>> {}:{} <<<", getTitle(), getVersion());
|
||||||
SpringApplication.run(TemplateServiceApplication.class, args);
|
SpringApplication.run(OParlServiceApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getTitle() {
|
private static String getTitle() {
|
||||||
return Optional.ofNullable(TemplateServiceApplication.class.getPackage().getImplementationTitle())
|
return Optional.ofNullable(OParlServiceApplication.class.getPackage().getImplementationTitle())
|
||||||
.orElse("start");
|
.orElse("start");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getVersion() {
|
private static String getVersion() {
|
||||||
return Optional.ofNullable(TemplateServiceApplication.class.getPackage().getImplementationVersion())
|
return Optional.ofNullable(OParlServiceApplication.class.getPackage().getImplementationVersion())
|
||||||
.orElse("snapshot");
|
.orElse("snapshot");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package de.twomartens.templateservice.actuator;
|
package de.twomartens.oparlservice.actuator;
|
||||||
|
|
||||||
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
|
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
|
||||||
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
|
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
import org.springframework.boot.actuate.health.HealthIndicator;
|
|
@ -1,8 +1,8 @@
|
||||||
package de.twomartens.templateservice.actuator;
|
package de.twomartens.oparlservice.actuator;
|
||||||
|
|
||||||
import de.twomartens.templateservice.entity.Greeting;
|
import de.twomartens.oparlservice.entity.Greeting;
|
||||||
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
|
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
|
||||||
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
|
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.twomartens.templateservice.configs;
|
package de.twomartens.oparlservice.configs;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
@ -6,8 +6,8 @@ import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties(prefix = "de.twomartens.templateservice")
|
@ConfigurationProperties(prefix = "de.twomartens.oparlservice")
|
||||||
public class TemplateServiceProperties {
|
public class OParlServiceProperties {
|
||||||
|
|
||||||
private final Template template = new Template();
|
private final Template template = new Template();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.twomartens.templateservice.configs;
|
package de.twomartens.oparlservice.configs;
|
||||||
|
|
||||||
import de.twomartens.templateservice.interceptors.RequestTypeInterceptor;
|
import de.twomartens.oparlservice.interceptors.RequestTypeInterceptor;
|
||||||
import de.twomartens.templateservice.interceptors.TraceIdInterceptor;
|
import de.twomartens.oparlservice.interceptors.TraceIdInterceptor;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
|
@ -1,7 +1,7 @@
|
||||||
package de.twomartens.templateservice.control;
|
package de.twomartens.oparlservice.control;
|
||||||
|
|
||||||
import de.twomartens.templateservice.entity.Greeting;
|
import de.twomartens.oparlservice.entity.Greeting;
|
||||||
import de.twomartens.templateservice.service.GreetingService;
|
import de.twomartens.oparlservice.service.GreetingService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.twomartens.templateservice.entity;
|
package de.twomartens.oparlservice.entity;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.twomartens.templateservice.interceptors;
|
package de.twomartens.oparlservice.interceptors;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.twomartens.templateservice.interceptors;
|
package de.twomartens.oparlservice.interceptors;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
|
@ -1,6 +1,6 @@
|
||||||
package de.twomartens.templateservice.service;
|
package de.twomartens.oparlservice.service;
|
||||||
|
|
||||||
import de.twomartens.templateservice.configs.TemplateServiceProperties;
|
import de.twomartens.oparlservice.configs.OParlServiceProperties;
|
||||||
import io.micrometer.core.instrument.Counter;
|
import io.micrometer.core.instrument.Counter;
|
||||||
import io.micrometer.core.instrument.MeterRegistry;
|
import io.micrometer.core.instrument.MeterRegistry;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -11,10 +11,10 @@ import org.springframework.stereotype.Service;
|
||||||
public class GreetingService {
|
public class GreetingService {
|
||||||
|
|
||||||
private final MeterRegistry meterRegistry;
|
private final MeterRegistry meterRegistry;
|
||||||
private final TemplateServiceProperties properties;
|
private final OParlServiceProperties properties;
|
||||||
private final Counter counter;
|
private final Counter counter;
|
||||||
|
|
||||||
public GreetingService(MeterRegistry meterRegistry, TemplateServiceProperties properties) {
|
public GreetingService(MeterRegistry meterRegistry, OParlServiceProperties properties) {
|
||||||
this.meterRegistry = meterRegistry;
|
this.meterRegistry = meterRegistry;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
counter = meterRegistry.counter("infodb.callCounter");
|
counter = meterRegistry.counter("infodb.callCounter");
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
package de.twomartens.templateservice.control;
|
package de.twomartens.oparlservice.control;
|
||||||
|
|
||||||
import de.twomartens.templateservice.service.GreetingService;
|
import de.twomartens.oparlservice.service.GreetingService;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.BDDMockito;
|
import org.mockito.BDDMockito;
|
|
@ -1,6 +1,6 @@
|
||||||
package de.twomartens.templateservice.service;
|
package de.twomartens.oparlservice.service;
|
||||||
|
|
||||||
import de.twomartens.templateservice.configs.TemplateServiceProperties;
|
import de.twomartens.oparlservice.configs.OParlServiceProperties;
|
||||||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -17,10 +17,10 @@ class GreetingServiceTest {
|
||||||
private GreetingService service;
|
private GreetingService service;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private TemplateServiceProperties properties;
|
private OParlServiceProperties properties;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private TemplateServiceProperties.Template template;
|
private OParlServiceProperties.Template template;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach() {
|
void beforeEach() {
|
|
@ -1,6 +1,6 @@
|
||||||
rootProject.name = projectname
|
rootProject.name = projectname
|
||||||
|
|
||||||
include 'template-server'
|
include 'oparl-server'
|
||||||
|
|
||||||
rootProject.children.each { subproject ->
|
rootProject.children.each { subproject ->
|
||||||
subproject.buildFileName = "${subproject.name}.gradle"
|
subproject.buildFileName = "${subproject.name}.gradle"
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue