Skip to content

Commit

Permalink
Merge pull request #69 from onewelcome/update-sb-and-java
Browse files Browse the repository at this point in the history
Update spring boot to 3.x and java to 17
  • Loading branch information
jmpavlec authored Mar 21, 2023
2 parents 03ad68c + 194cd50 commit a684f4c
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ orbs:
context: dev-context
executor:
name: onegini-build/maven-builder
tag: "11.0"
tag: "17.0-browsers"

.component-type-application: &component-type-application
component_type: application
Expand Down
7 changes: 5 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<docker.groupName>onegini</docker.groupName>
<docker.imageName>example-resource-gateway</docker.imageName>

<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Resource Gateway dependencies -->
Expand All @@ -38,7 +38,7 @@
<maven-enforcer-plugin.version>3.2.1</maven-enforcer-plugin.version>
<onegini-communication-resiliency-starter.version>3.2.2</onegini-communication-resiliency-starter.version>
<snakeyaml.version>2.0</snakeyaml.version>
<spring-boot.version>2.7.9</spring-boot.version>
<spring-boot.version>3.0.4</spring-boot.version>
</properties>

<licenses>
Expand Down Expand Up @@ -191,6 +191,9 @@
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<configuration>
<from>
<image>gcr.io/distroless/java17-debian11:nonroot</image>
</from>
<to>
<image>snapshot.onegini.com/${docker.groupName}/${docker.imageName}</image>
<tags>${project.version},${git.commit.id.describe}</tags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
package com.onegini.examples.resourcegateway.config;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.web.client.RestTemplate;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;

@Configuration
public class ResourceGatewayConfig {

@Bean
public Jackson2ObjectMapperBuilder jacksonBuilder() {
final Jackson2ObjectMapperBuilder b = new Jackson2ObjectMapperBuilder();
b.propertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
.serializationInclusion(JsonInclude.Include.NON_NULL);
return b;
}
@Bean
public Jackson2ObjectMapperBuilder jacksonBuilder() {
final Jackson2ObjectMapperBuilder b = new Jackson2ObjectMapperBuilder();
b.propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
.serializationInclusion(JsonInclude.Include.NON_NULL);
return b;
}

@Bean
public RestTemplate restTemplate(final RestTemplateBuilder builder) {
return builder
.build();
}
@Bean
public RestTemplate restTemplate(final RestTemplateBuilder builder) {
return builder
.build();
}

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package com.onegini.examples.resourcegateway.service;

import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.HttpStatus.OK;

import javax.annotation.Resource;

import com.onegini.examples.resourcegateway.config.DeviceApiConfig;
import com.onegini.examples.resourcegateway.model.DeviceList;
import com.onegini.examples.resourcegateway.util.BasicAuthenticationHeaderBuilder;
import jakarta.annotation.Resource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.onegini.examples.resourcegateway.config.DeviceApiConfig;
import com.onegini.examples.resourcegateway.model.DeviceList;
import com.onegini.examples.resourcegateway.util.BasicAuthenticationHeaderBuilder;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.HttpStatus.OK;

@Service
public class DeviceApiRequestService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
package com.onegini.examples.resourcegateway.service.tokenintrospection;

import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;

import javax.annotation.Resource;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import com.onegini.examples.resourcegateway.config.TokenServerConfig;
import com.onegini.examples.resourcegateway.model.TokenIntrospectionResult;
import com.onegini.examples.resourcegateway.model.exception.TokenServerException;
import com.onegini.examples.resourcegateway.util.BasicAuthenticationHeaderBuilder;
import jakarta.annotation.Resource;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

import com.onegini.examples.resourcegateway.config.TokenServerConfig;
import com.onegini.examples.resourcegateway.model.TokenIntrospectionResult;
import com.onegini.examples.resourcegateway.model.exception.TokenServerException;
import com.onegini.examples.resourcegateway.util.BasicAuthenticationHeaderBuilder;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;

@Service
public class TokenIntrospectionRequestExecutor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.onegini.examples.resourcegateway.service.tokenintrospection;


import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.onegini.examples.resourcegateway.model.TokenIntrospectionResult;
import com.onegini.examples.resourcegateway.model.exception.InvalidAccessTokenException;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class TokenIntrospectionService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,27 @@
package com.onegini.examples.resourcegateway.web;

import static com.onegini.examples.resourcegateway.service.ScopeValidationService.SCOPE_APPLICATION_DETAILS;
import static com.onegini.examples.resourcegateway.service.ScopeValidationService.SCOPE_READ;
import static com.onegini.examples.resourcegateway.service.ScopeValidationService.SCOPE_WRITE;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

import com.onegini.examples.resourcegateway.model.ApplicationDetails;
import com.onegini.examples.resourcegateway.model.DecoratedUser;
import com.onegini.examples.resourcegateway.model.DeviceList;
import com.onegini.examples.resourcegateway.model.FormDataWithFiles;
import com.onegini.examples.resourcegateway.model.MultipartResponse;
import com.onegini.examples.resourcegateway.model.TokenIntrospectionResult;
import com.onegini.examples.resourcegateway.service.AccessTokenExtractor;
import com.onegini.examples.resourcegateway.service.DeviceApiRequestService;
import com.onegini.examples.resourcegateway.service.MultipartService;
import com.onegini.examples.resourcegateway.service.ScopeValidationService;
import com.onegini.examples.resourcegateway.service.TokenTypeValidationService;
import com.onegini.examples.resourcegateway.model.*;
import com.onegini.examples.resourcegateway.service.*;
import com.onegini.examples.resourcegateway.service.tokenintrospection.TokenIntrospectionService;
import com.onegini.examples.resourcegateway.util.DecoratedUserIdBuilder;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import static com.onegini.examples.resourcegateway.service.ScopeValidationService.*;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

@Slf4j
@RestController
@RequestMapping(value = "/resources")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package com.onegini.examples.resourcegateway;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS;

import javax.annotation.Resource;

import com.onegini.examples.resourcegateway.web.ResourcesController;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import com.onegini.examples.resourcegateway.web.ResourcesController;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS;

@ExtendWith(SpringExtension.class)
@DirtiesContext(classMode = AFTER_CLASS)
Expand Down

0 comments on commit a684f4c

Please sign in to comment.