1

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:
Mahgs
2020-03-04 16:56:40 +01:00
5 changed files with 56 additions and 15 deletions

11
Dockerfile Normal file
View 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"]

View File

@ -1,3 +1,5 @@
import com.github.spotbugs.SpotBugsTask
plugins {
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
@ -12,14 +14,10 @@ spotbugs{
toolVersion = '4.0.0-RC1'
}
tasks.withType(com.github.spotbugs.SpotBugsTask) {
tasks.withType(SpotBugsTask) {
reports {
html {
enabled = true
}
xml {
enabled = false
}
xml.enabled = false
html.enabled = true
}
}
@ -60,8 +58,8 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'mops:styleguide:2.0.0'
implementation 'org.keycloak:keycloak-spring-boot-starter:9.0.0'
implementation 'org.keycloak.bom:keycloak-adapter-bom:3.3.0.Final'
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.7.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.7.0'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
@ -70,8 +68,10 @@ dependencies {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.security:spring-security-test'
compile('org.springframework.boot:spring-boot-starter-web')
}
test {
useJUnitPlatform()
}

View File

@ -238,12 +238,6 @@
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<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">
<property name="tokens"
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,

View File

@ -2,10 +2,22 @@ package mops.gruppen2;
import org.springframework.boot.SpringApplication;
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
@EnableSwagger2
public class Gruppen2Application {
public static void main(String[] args) {
SpringApplication.run(Gruppen2Application.class, args);
}
@Bean
public Docket productAPI(){
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.basePackage("mops.gruppen2")).build();
}
}

View File

@ -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";
}
}