Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Spring Boot 3.2 #24098

Merged
merged 66 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
28d6e51
Upgrade to Spring Boot 3.2
mraible Nov 4, 2023
bc0816f
Add Spring Boot milestone repository
mraible Nov 4, 2023
291f68c
Update snapshots
mraible Nov 4, 2023
a255504
Add Spring Boot milestone repository to pom.xml
mraible Nov 4, 2023
25fc421
update spring-boot to 3.2.0-RC2
mshima Nov 4, 2023
c8380be
Merge branch 'main' into spring-boot-3.2
mraible Nov 20, 2023
5a44b19
Fix deprecated org.springframework.util.Base64Utils
mraible Nov 20, 2023
65e2b56
Base64.Encoder -> Base64.getEncoder()
mraible Nov 21, 2023
56cebf9
Fix error: Name for argument of type [java.lang.String] not specified…
mraible Nov 21, 2023
37170a9
Fix Elasticsearch @RequestParam
mraible Nov 21, 2023
4b318e4
Fix Kafka @RequestParam
mraible Nov 21, 2023
e124a66
name and value parameters are aliases of each other; remove name
mraible Nov 21, 2023
e2d7e71
Update property name for Spring Boot 3.2
mraible Nov 21, 2023
e7fcd7d
Change from deprecated UriComponentsBuilder.fromHttpRequest() to Forw…
mraible Nov 21, 2023
f036b41
Merge branch 'main' into spring-boot-3.2
DanielFran Nov 23, 2023
5b39490
Update spring-boot version to 3.2.0
DanielFran Nov 23, 2023
f7a49b3
Update hibernate version to 6.3.1.Final
DanielFran Nov 23, 2023
7268b2d
Update cassandra driver version to 4.17.0
DanielFran Nov 23, 2023
b751e0e
Update elasticsearch client version to 8.10.4
DanielFran Nov 23, 2023
bf69ae1
Update jhipster-bom version to 8.1.0-SNAPSHOT
DanielFran Nov 23, 2023
8b8f498
Try Hibernate 6.4.0.Final
mraible Nov 25, 2023
2d66996
Change back to Hibernate 6.3.1.Final
mraible Nov 26, 2023
748b7d7
Change Infinispan dependency to infinispan-hibernate-cache-v62 for Hi…
mraible Nov 26, 2023
0f2f2d6
Update snapshots
mraible Nov 26, 2023
ab9fa67
Use `claims['sub']` for principal expression with JWT authentication
mraible Nov 27, 2023
0219590
Revert using `claims['sub'] for principal expression with JWT authent…
mraible Nov 28, 2023
5f864fb
Merge branch 'main' into spring-boot-3.2
mraible Nov 28, 2023
963c06b
Merge branch 'main' into spring-boot-3.2
DanielFran Dec 1, 2023
e88cec6
Merge remote-tracking branch 'origin/main' into spring-boot-3.2
DanielFran Dec 4, 2023
49e2d87
Merge branch 'main' into spring-boot-3.2
DanielFran Dec 4, 2023
54a3db2
build(deps): bump the typescript-eslint group with 2 updates
dependabot[bot] Dec 4, 2023
134415b
build(deps): bump type-fest from 4.8.2 to 4.8.3
dependabot[bot] Dec 4, 2023
5d19520
build(deps-dev): bump eslint-config-prettier from 9.0.0 to 9.1.0
dependabot[bot] Dec 4, 2023
081ff81
build(deps): bump prettier-plugin-packagejson from 2.4.6 to 2.4.7
dependabot[bot] Dec 4, 2023
4524125
build(deps-dev): bump @types/node from 18.19.1 to 18.19.2
dependabot[bot] Dec 4, 2023
1559b2d
build(deps-dev): bump the typescript-eslint group
dependabot[bot] Dec 5, 2023
fb60af7
build(deps-dev): bump @types/react in /generators/react/resources
dependabot[bot] Dec 5, 2023
72c3eff
build(deps): bump vue from 3.3.9 to 3.3.10 in /generators/vue/resources
dependabot[bot] Dec 5, 2023
fde8a92
build(deps-dev): bump vite in /generators/vue/resources
dependabot[bot] Dec 5, 2023
5b4afd8
build(deps-dev): bump vitest in /generators/vue/resources (#24472)
dependabot[bot] Dec 5, 2023
94aa2c5
build(deps-dev): bump the typescript-eslint group
dependabot[bot] Dec 5, 2023
dc2065f
build(deps-dev): bump @cypress/code-coverage
dependabot[bot] Dec 5, 2023
42e6d58
group more dependencies
mshima Dec 5, 2023
d1d96c1
split feign client generator
mshima Dec 4, 2023
9d76d5a
move OAuthIdpTokenResponseDTO to feign-client
mshima Dec 5, 2023
48e986d
cleanup OAuthIdpTokenResponseDTO
mshima Dec 5, 2023
dbb9317
adjust feign-client cleanup
mshima Dec 5, 2023
9636eb6
build(deps): bump docker/metadata-action from 5.2.0 to 5.3.0
dependabot[bot] Dec 5, 2023
2f8735d
build(deps): bump @vueuse/core in /generators/vue/resources
dependabot[bot] Dec 5, 2023
7a6b9c3
build(deps-dev): bump vitest-sonar-reporter in /generators/vue/resour…
dependabot[bot] Dec 5, 2023
8f9ada5
build(deps): bump actions/labeler from 4 to 5
dependabot[bot] Dec 5, 2023
53e3271
build(deps): bump vitest from 0.34.6 to 1.0.1 in /generators/generate…
dependabot[bot] Dec 5, 2023
e47b280
Revert "build(deps): bump actions/labeler from 4 to 5"
DanielFran Dec 5, 2023
3e2bb88
build(deps-dev): bump @types/jest in /generators/react/resources
dependabot[bot] Dec 6, 2023
37b116d
build(deps-dev): bump core-js in /generators/react/resources
dependabot[bot] Dec 6, 2023
4165c11
build(deps-dev): bump vue-tsc in /generators/vue/resources
dependabot[bot] Dec 6, 2023
30f6661
build(deps-dev): bump @types/jest in /generators/angular/resources
dependabot[bot] Dec 6, 2023
9895526
build(deps-dev): bump cypress in /generators/client/resources
dependabot[bot] Dec 6, 2023
c41abcb
build(deps): bump com.gradle.common-custom-user-data-gradle-plugin
dependabot[bot] Dec 6, 2023
ac3db09
build(deps): bump com.gradle.enterprise in /generators/server/resources
dependabot[bot] Dec 6, 2023
e5c26e0
Spring Milestone repo is no longer needed
mraible Dec 6, 2023
ea202b9
Update snapshot
mraible Dec 6, 2023
0bf2f7a
Add missing semicolon
mraible Dec 6, 2023
2386cc3
Merge branch 'main' into spring-boot-3.2
mraible Dec 7, 2023
9f90787
Change `jhipster-bom-branch` to auto
mraible Dec 7, 2023
586ffcc
Remove snapshot and milestone logic
mraible Dec 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions generators/generator-constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
export const BLUEPRINT_API_VERSION = 'jhipster-8';
// jhipster-bom version
export const JHIPSTER_DEPENDENCIES_VERSION = '8.0.1-SNAPSHOT';
export const JHIPSTER_DEPENDENCIES_VERSION = '8.1.0-SNAPSHOT';
// Version of Java
export const JAVA_VERSION = '17';
export const JAVA_COMPATIBLE_VERSIONS = ['17', '18', '19', '20', '21'];
Expand All @@ -36,22 +36,22 @@ export const javaDependencies = {
/**
* spring-boot version should match the one managed by https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/JHIPSTER_DEPENDENCIES_VERSION
*/
'spring-boot': '3.1.5',
'spring-boot': '3.2.0',
/*
* hibernate version should match the one managed by https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/SPRING_BOOT_VERSION
* Required due to hibernate-jpamodelgen annotation processor.
*/
hibernate: '6.2.13.Final',
hibernate: '6.3.1.Final',
/*
* cassandra driver version should match the one managed by https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/SPRING_BOOT_VERSION
* Required due to java-driver-mapper-processor annotation processor.
*/
cassandra: '4.15.0',
cassandra: '4.17.0',
};
Object.freeze(javaDependencies);

// The version should be coherent with the one from spring-data-elasticsearch project
export const ELASTICSEARCH_TAG = '8.7.1';
export const ELASTICSEARCH_TAG = '8.10.4';
export const ELASTICSEARCH_IMAGE = 'docker.elastic.co/elasticsearch/elasticsearch';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ _%>
return ResponseEntity.ok().body(entityList);
<%_ } else { _%>
Page<<%= instanceType %>> page = <%= entityInstance %>QueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (!reactive) { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } else { %>UriComponentsBuilder.fromHttpRequest(request)<% } %>, page);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (!reactive) { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } else { %>ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders())<% } %>, page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
<%_ } _%>
<%_ } else { _%>
Expand All @@ -47,7 +47,7 @@ _%>
ResponseEntity.ok()
.headers(
PaginationUtil.generatePaginationHttpHeaders(
UriComponentsBuilder.fromHttpRequest(request),
ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders()),
new PageImpl<>(countWithEntities.getT2(), pageable, countWithEntities.getT1())
)
).body(countWithEntities.getT2())
Expand Down Expand Up @@ -75,7 +75,7 @@ _%>
}
<%_ } else { _%>
<%_ if (paginationNo) { _%>
public <% if (reactive) { %>Mono<<% } %>List<<%= instanceType %>><% if (reactive) { %>><% } %> getAll<%= entityClassPlural %>(<% if (fieldsContainNoOwnerOneToOne) { %>@RequestParam(required = false) String filter<% } %><% if (implementsEagerLoadApis && fieldsContainNoOwnerOneToOne) { %>,<% } %><% if (implementsEagerLoadApis) { %>@RequestParam(required = false, defaultValue = "true") boolean eagerload<% } %>) {<%- include('get_all_stream_template', {viaService: viaService}); -%>
public <% if (reactive) { %>Mono<<% } %>List<<%= instanceType %>><% if (reactive) { %>><% } %> getAll<%= entityClassPlural %>(<% if (fieldsContainNoOwnerOneToOne) { %>@RequestParam(name = "filter", required = false) String filter<% } %><% if (implementsEagerLoadApis && fieldsContainNoOwnerOneToOne) { %>,<% } %><% if (implementsEagerLoadApis) { %>@RequestParam(name = "eagerload", required = false, defaultValue = "true") boolean eagerload<% } %>) {<%- include('get_all_stream_template', {viaService: viaService}); -%>
log.debug("REST request to get all <%= entityClassPlural %>");
<%_ if (viaService) { _%>
return <%= entityInstance %>Service.findAll()<% if (reactive) { %>.collectList()<% } %>;
Expand All @@ -96,15 +96,15 @@ _%>
return <%= entityInstance %>Repository.findAll()<% if (reactive) { %>.collectList()<% } %>;
<%_ } _%>
<%_ } else { _%>
public <% if (reactive) { %>Mono<ResponseEntity<List<<%= instanceType %>>>><% } else { %>ResponseEntity<List<<%= instanceType %>>><% } %> getAll<%= entityClassPlural %>(@org.springdoc.core.annotations.ParameterObject Pageable pageable<% if (reactive) { %>, ServerHttpRequest request<% } %><% if (fieldsContainNoOwnerOneToOne) { %>, @RequestParam(required = false) String filter<% } %><% if (implementsEagerLoadApis) { %>, @RequestParam(required = false, defaultValue = "true") boolean eagerload<% } %>) {<%- include('get_all_stream_template', {viaService: viaService}); -%>
public <% if (reactive) { %>Mono<ResponseEntity<List<<%= instanceType %>>>><% } else { %>ResponseEntity<List<<%= instanceType %>>><% } %> getAll<%= entityClassPlural %>(@org.springdoc.core.annotations.ParameterObject Pageable pageable<% if (reactive) { %>, ServerHttpRequest request<% } %><% if (fieldsContainNoOwnerOneToOne) { %>, @RequestParam(name = "filter", required = false) String filter<% } %><% if (implementsEagerLoadApis) { %>, @RequestParam(name = "eagerload", required = false, defaultValue = "true") boolean eagerload<% } %>) {<%- include('get_all_stream_template', {viaService: viaService}); -%>
log.debug("REST request to get a page of <%= entityClassPlural %>");
<%_ if (reactive) { _%>
return <%= entityInstance %><%= viaService ? 'Service.countAll' : 'Repository.count' %>().zipWith(<%= entityInstance %><%= viaService ? 'Service.findAll' : 'Repository.findAllBy' %>(pageable)<%= reactiveEntityToDto %>.collectList())
.map(countWithEntities ->
ResponseEntity.ok()
.headers(
PaginationUtil.generatePaginationHttpHeaders(
UriComponentsBuilder.fromHttpRequest(request),
ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders()),
new PageImpl<>(countWithEntities.getT2(), pageable, countWithEntities.getT1())
)
).body(countWithEntities.getT2())
Expand All @@ -117,10 +117,10 @@ _%>
} else {
page = <%= entityInstance %><%= viaService ? 'Service' : 'Repository' %>.findAll(pageable)<%= reactiveEntityToDto %>;
}
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (reactive) { %>UriComponentsBuilder.fromHttpRequest(request)<% } else { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } %>, page);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (reactive) { %>ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders())<% } else { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } %>, page);
<%_ } else { _%>
Page<<%= instanceType %>> page = <%= entityInstance %><%= viaService ? 'Service' : 'Repository' %>.findAll(pageable)<%= reactiveEntityToDto %>;
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (reactive) { %>UriComponentsBuilder.fromHttpRequest(request)<% } else { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } %>, page);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (reactive) { %>ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders())<% } else { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } %>, page);
<%_ } _%>
return ResponseEntity.ok().headers(headers).body(page.getContent());
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
const entityToDtoReference = mapper + '::' + 'toDto';
const entityListToDtoListReference = mapper + '.' + 'toDto';
if (paginationNo) { %>
public <% if (reactive) { %>Mono<<% } %>List<<%= instanceType %>><% if (reactive) { %>><% } %> search<%= entityClassPlural %>(@RequestParam String query) {
public <% if (reactive) { %>Mono<<% } %>List<<%= instanceType %>><% if (reactive) { %>><% } %> search<%= entityClassPlural %>(@RequestParam("query") String query) {
log.debug("REST request to search <%= entityClassPlural %> for query {}", query);<%- include('search_stream_template', {viaService: viaService, fromResource: true}); -%>
<% } else { %>
public <% if (reactive) { %>Mono<<% } %>ResponseEntity<<%= listOrFlux %><<%= instanceType %>>><% if (reactive) { %>><% } %> search<%= entityClassPlural %>(@RequestParam String query, @org.springdoc.core.annotations.ParameterObject Pageable pageable<% if (reactive) { %>, ServerHttpRequest request<% } %>) {
public <% if (reactive) { %>Mono<<% } %>ResponseEntity<<%= listOrFlux %><<%= instanceType %>>><% if (reactive) { %>><% } %> search<%= entityClassPlural %>(@RequestParam("query") String query, @org.springdoc.core.annotations.ParameterObject Pageable pageable<% if (reactive) { %>, ServerHttpRequest request<% } %>) {
log.debug("REST request to search for a page of <%= entityClassPlural %> for query {}", query);
<%_ if (reactive) { _%>
return <%= entityInstance %><%= viaService ?
'Service.' + (searchEngineElasticsearch ? 'searchCount' : 'countAll') :
(searchEngineElasticsearch ? 'Search' : '') + 'Repository.count' %>()
.map(total -> new PageImpl<>(new ArrayList<>(), pageable, total))
.map(page -> PaginationUtil.generatePaginationHttpHeaders(UriComponentsBuilder.fromHttpRequest(request), page))
.map(page -> PaginationUtil.generatePaginationHttpHeaders(ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders()), page))
.map(headers -> ResponseEntity.ok().headers(headers).body(<%= entityInstance %><%= viaService ? 'Service' : (searchEngineElasticsearch ? 'Search' : '') + 'Repository' %>.search(query, pageable)<% if (!viaService && dtoMapstruct) { %>.map(<%= entityToDtoReference %>)<% } %>));
<%_ } else { _%>
try {
Expand All @@ -43,7 +43,7 @@ if (paginationNo) { %>
<%_ } else { _%>
Page<<%= persistClass %>> page = <%= entityInstance %><% if (searchEngineElasticsearch) { %>Search<% } %>Repository.search(query, pageable);
<%_ } _%>
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (reactive) { %>UriComponentsBuilder.fromHttpRequest(request)<% } else { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } %>, page);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(<% if (reactive) { %>ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders())<% } else { %>ServletUriComponentsBuilder.fromCurrentRequest()<% } %>, page);
return ResponseEntity.ok().headers(headers).body(<% if (!viaService && dtoMapstruct) { %><%= entityListToDtoListReference %>(<% } %>page.getContent()<% if (!viaService && dtoMapstruct) { %>)<% } %>);
} catch (RuntimeException e) {
<% if (searchEngineElasticsearch) { %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest;
<%_ } _%>
<%_ if (reactive) { _%>
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.web.util.ForwardedHeaderUtils;
<%_ } else { _%>
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
<%_ } _%>
Expand Down Expand Up @@ -398,7 +398,7 @@ public class <%= entityClass %>Resource {
<%_ if (databaseTypeSql && isUsingMapsId && !viaService) { _%>
@Transactional(readOnly = true)
<%_ } _%>
public <% if (reactive) { %>Mono<<% } %>ResponseEntity<<%= instanceType %>><% if (reactive) { %>><% } %> get<%= entityClass %>(@PathVariable <%= primaryKey.type %> id) {
public <% if (reactive) { %>Mono<<% } %>ResponseEntity<<%= instanceType %>><% if (reactive) { %>><% } %> get<%= entityClass %>(@PathVariable("id") <%= primaryKey.type %> id) {
log.debug("REST request to get <%= entityClass %> : {}", id);<%- include('../../_partials_entity_/get_template', {viaService, returnDirectly:false, implementsEagerLoadApis}); -%>
return ResponseUtil.wrapOrNotFound(<%= instanceName %>);
}
Expand All @@ -411,7 +411,7 @@ public class <%= entityClass %>Resource {
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/{id}")
public <% if (reactive) { %>Mono<<% } %>ResponseEntity<Void><% if (reactive) { %>><% } %> delete<%= entityClass %>(@PathVariable <%= primaryKey.type %> id) {
public <% if (reactive) { %>Mono<<% } %>ResponseEntity<Void><% if (reactive) { %>><% } %> delete<%= entityClass %>(@PathVariable("id") <%= primaryKey.type %> id) {
log.debug("REST request to delete <%= entityClass %> : {}", id);
<%- include('../../_partials_entity_/delete_template', {viaService: viaService, fromResource: true}); -%>
<%_ if (reactive) { _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public class AccountResource {
* @throws IllegalArgumentException if the series couldn't be URL decoded.
*/
@DeleteMapping("/account/sessions/{series}")
public void invalidateSession(@PathVariable String series) {
public void invalidateSession(@PathVariable("series") String series) {
String decodedSeries = URLDecoder.decode(series, StandardCharsets.UTF_8);
SecurityUtils.getCurrentUserLogin()
.flatMap(userRepository::findOneByLogin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.*;
<%_ if (reactive) { _%>
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.web.util.ForwardedHeaderUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
<%_ } else {_%>
Expand Down Expand Up @@ -133,7 +133,7 @@ public class PublicUserResource {

return userService.countManagedUsers()
.map(total -> new PageImpl<>(new ArrayList<>(), pageable, total))
.map(page -> PaginationUtil.generatePaginationHttpHeaders(UriComponentsBuilder.fromHttpRequest(request), page))
.map(page -> PaginationUtil.generatePaginationHttpHeaders(ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders()), page))
.map(headers -> ResponseEntity.ok().headers(headers).body(userService.getAllPublicUsers(pageable)));
}
<%_ } else { _%>
Expand Down Expand Up @@ -181,7 +181,7 @@ public class PublicUserResource {
* @return the result of the search.
*/
@GetMapping("/users/_search/{query}")
public <% if(reactive) { %>Mono<<% } %>List<<%= user.dtoClass %>><% if(reactive) { %>><% } %> search(@PathVariable String query) {
public <% if(reactive) { %>Mono<<% } %>List<<%= user.dtoClass %>><% if(reactive) { %>><% } %> search(@PathVariable("query") String query) {
<%_ if (searchEngineElasticsearch) { _%>
<%_ if (reactive) { _%>
return userSearchRepository.search(query).map(<%= user.dtoClass %>::new).collectList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
<%_ if (reactive) { _%>
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.web.util.ForwardedHeaderUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
<%_ } else { _%>
Expand Down Expand Up @@ -270,7 +270,7 @@ public class UserResource {

return userService.countManagedUsers()
.map(total -> new PageImpl<>(new ArrayList<>(), pageable, total))
.map(page -> PaginationUtil.generatePaginationHttpHeaders(UriComponentsBuilder.fromHttpRequest(request), page))
.map(page -> PaginationUtil.generatePaginationHttpHeaders(ForwardedHeaderUtils.adaptFromForwardedHeaders(request.getURI(), request.getHeaders()), page))
.map(headers -> ResponseEntity.ok().headers(headers).body(userService.getAllManagedUsers(pageable)));
<%_ } else { _%>
public ResponseEntity<List<<%= user.adminUserDto %>>> getAllUsers(@org.springdoc.core.annotations.ParameterObject Pageable pageable) {
Expand Down Expand Up @@ -306,13 +306,13 @@ public class UserResource {
@GetMapping("/users/{login}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
<%_ if (reactive) { _%>
public Mono<<%= user.adminUserDto %>> getUser(@PathVariable String login) {
public Mono<<%= user.adminUserDto %>> getUser(@PathVariable("login") String login) {
log.debug("REST request to get User : {}", login);
return userService.getUserWithAuthoritiesByLogin(login)
.map(<%= user.adminUserDto %>::new)
.switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND)));
<%_ } else { _%>
public ResponseEntity<<%= user.adminUserDto %>> getUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
public ResponseEntity<<%= user.adminUserDto %>> getUser(@PathVariable("login") @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
log.debug("REST request to get User : {}", login);
return ResponseUtil.wrapOrNotFound(
userService.getUserWithAuthoritiesByLogin(login)
Expand All @@ -329,12 +329,12 @@ public class UserResource {
@DeleteMapping("/users/{login}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
<%_ if (reactive) { _%>
public Mono<ResponseEntity<Void>> deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
public Mono<ResponseEntity<Void>> deleteUser(@PathVariable("login") @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
log.debug("REST request to delete User: {}", login);
return userService.deleteUser(login)
.then(Mono.just(ResponseEntity.noContent().headers(HeaderUtil.createAlert( applicationName, <% if (enableTranslation) { %> "userManagement.deleted"<% } else { %> "A user is deleted with identifier " + login<% } %>, login)).build()));
<%_ } else { _%>
public ResponseEntity<Void> deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
public ResponseEntity<Void> deleteUser(@PathVariable("login") @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
log.debug("REST request to delete User: {}", login);
userService.deleteUser(login);
return ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %> "userManagement.deleted"<% } else { %> "A user is deleted with identifier " + login<% } %>, login)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ management:
export:
enabled: true
step: 60
observations:
key-values:
application: ${spring.application.name}
metrics:
enable:
http: true
Expand All @@ -154,8 +157,6 @@ management:
all: true
percentiles:
all: 0, 0.5, 0.75, 0.95, 0.99, 1.0
tags:
application: ${spring.application.name}
data:
repository:
autotime:
Expand Down
Loading
Loading