Merge remote-tracking branch 'origin/master' into keycloak
# Conflicts: # build.gradle # src/main/java/mops/gruppen2/security/KeycloakConfig.java # src/main/resources/application.properties
This commit is contained in:
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM gradle:jdk11 AS build
|
||||||
|
COPY --chown=gradle:gradle . /home/gradle/src
|
||||||
|
WORKDIR /home/gradle/src
|
||||||
|
RUN gradle bootJar --no-daemon
|
||||||
|
|
||||||
|
FROM openjdk:11-jre-slim
|
||||||
|
EXPOSE 8080
|
||||||
|
RUN mkdir /app
|
||||||
|
COPY --from=build /home/gradle/src/build/libs/*.jar /app/gruppen2.jar
|
||||||
|
ENTRYPOINT ["java"]
|
||||||
|
CMD ["-jar", "/app/gruppen2.jar"]
|
||||||
18
build.gradle
18
build.gradle
@ -1,3 +1,5 @@
|
|||||||
|
import com.github.spotbugs.SpotBugsTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.springframework.boot' version '2.2.5.RELEASE'
|
id 'org.springframework.boot' version '2.2.5.RELEASE'
|
||||||
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
||||||
@ -12,14 +14,10 @@ spotbugs{
|
|||||||
toolVersion = '4.0.0-RC1'
|
toolVersion = '4.0.0-RC1'
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(com.github.spotbugs.SpotBugsTask) {
|
tasks.withType(SpotBugsTask) {
|
||||||
reports {
|
reports {
|
||||||
html {
|
xml.enabled = false
|
||||||
enabled = true
|
html.enabled = true
|
||||||
}
|
|
||||||
xml {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,8 +58,8 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||||
implementation 'mops:styleguide:2.0.0'
|
implementation 'mops:styleguide:2.0.0'
|
||||||
implementation 'org.keycloak:keycloak-spring-boot-starter:9.0.0'
|
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.7.0'
|
||||||
implementation 'org.keycloak.bom:keycloak-adapter-bom:3.3.0.Final'
|
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.7.0'
|
||||||
compileOnly 'org.projectlombok:lombok'
|
compileOnly 'org.projectlombok:lombok'
|
||||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||||
runtimeOnly 'com.h2database:h2'
|
runtimeOnly 'com.h2database:h2'
|
||||||
@ -70,8 +68,10 @@ dependencies {
|
|||||||
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
|
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
|
||||||
}
|
}
|
||||||
testImplementation 'org.springframework.security:spring-security-test'
|
testImplementation 'org.springframework.security:spring-security-test'
|
||||||
|
compile('org.springframework.boot:spring-boot-starter-web')
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -238,12 +238,6 @@
|
|||||||
</module>
|
</module>
|
||||||
<module name="OverloadMethodsDeclarationOrder"/>
|
<module name="OverloadMethodsDeclarationOrder"/>
|
||||||
<module name="VariableDeclarationUsageDistance"/>
|
<module name="VariableDeclarationUsageDistance"/>
|
||||||
<module name="CustomImportOrder">
|
|
||||||
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
|
||||||
<property name="separateLineBetweenGroups" value="true"/>
|
|
||||||
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
|
|
||||||
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
|
|
||||||
</module>
|
|
||||||
<module name="MethodParamPad">
|
<module name="MethodParamPad">
|
||||||
<property name="tokens"
|
<property name="tokens"
|
||||||
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
|
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
|
||||||
|
|||||||
@ -2,10 +2,22 @@ package mops.gruppen2;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableSwagger2
|
||||||
public class Gruppen2Application {
|
public class Gruppen2Application {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(Gruppen2Application.class, args);
|
SpringApplication.run(Gruppen2Application.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Docket productAPI(){
|
||||||
|
return new Docket(DocumentationType.SWAGGER_2).select()
|
||||||
|
.apis(RequestHandlerSelectors.basePackage("mops.gruppen2")).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
package mops.gruppen2.controllers;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class SwaggerAPIController {
|
||||||
|
@RequestMapping(value = "/products", method = RequestMethod.GET)
|
||||||
|
public List<String> getProducts(){
|
||||||
|
List<String> productList = new ArrayList<>();
|
||||||
|
productList.add("Honey");
|
||||||
|
productList.add("Almond");
|
||||||
|
return productList;
|
||||||
|
}
|
||||||
|
@RequestMapping(value = "/products", method = RequestMethod.POST)
|
||||||
|
public String createProduct() {
|
||||||
|
return "Product is saved successfully";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user