Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 12:43
    wilkinsona labeled #29583
  • 12:43
    wilkinsona unlabeled #29583
  • 12:43
    wilkinsona closed #29583
  • 12:43
    wilkinsona commented #29583
  • 12:43
    wilkinsona labeled #28188
  • 12:43
    wilkinsona labeled #28188
  • 12:43
    wilkinsona reopened #28188
  • 12:42
    wilkinsona commented #28188
  • 12:36
    wilkinsona commented #29571
  • 11:59
    wang-xiaowu commented #29571
  • 11:41
    wang-xiaowu commented #29571
  • 11:08
    wang-xiaowu commented #29571
  • 10:57
    ntinnemeier edited #29583
  • 10:57
    spring-projects-issues labeled #29583
  • 10:56
    ntinnemeier edited #29583
  • 10:55
    ntinnemeier opened #29583
  • 10:50
    wang-xiaowu commented #29571
  • 10:46
    ntinnemeier commented #28188
  • 10:46
    wang-xiaowu commented #29571
  • 10:43
    ntinnemeier commented #28188
Hi, i was working on resilience4j with springboot. but i was facing an issue where if i use @CircuitBreaker on a method its not working and if i add it over @GetMapping then it works. Can any one please help

  public BaseResponse pocRetry(HttpServletRequest request, HttpServletResponse response) {
    log.info("in poc retry poc resource");
    return getResponse(request, response);

  @CircuitBreaker(name = "pocService", fallbackMethod = "fallback")
  public BaseResponse pocRetryNew(HttpServletRequest request, HttpServletResponse response) {
    log.info("in poc retry poc resource");
    HttpEntity<SearchRequest> httpRequest = new HttpEntity<>(RestConstants.getJWTAuthHttpHeaders(false));
    log.info("Attempt no = {}", attempts++);
    ResponseEntity<BaseResponse> baseResponse = restTemplate
        .exchange(url + "/poc", HttpMethod.GET, httpRequest, BaseResponse.class);
    return baseResponse.getBody();


  @CircuitBreaker(name = "pocService", fallbackMethod = "fallback")
//  @Retry(name = "poc-retry", fallbackMethod = "fallback")
  public BaseResponse getResponse(HttpServletRequest request, HttpServletResponse response) {
    HttpEntity<SearchRequest> httpRequest = new HttpEntity<>(RestConstants.getJWTAuthHttpHeaders(false));
    log.info("Attempt no = {}", attempts++);
    ResponseEntity<BaseResponse> baseResponse = restTemplate
        .exchange(url + "/poc", HttpMethod.GET, httpRequest, BaseResponse.class);
    return baseResponse.getBody();

  public BaseResponse fallback(Exception e) {
    BaseResponse response = new BaseResponse();
    response.setMessage("this is fallback response - profile-data-service is down");
    return response;
retry-new api is working fine but retry api is not working
Any thoughts on if the Spring team considers it correct behavior that slashes are not supported in PathElement regexes?
10 replies
Is there any way a Spring-boot project accepts multiple command line arguments during runtime?
有啊,第一天来这里~逛逛先! 哈哈哈哈~~~
Donald F Coffin

I am maintaining a Spring Boot 2.6.2 application with the following ServletWebFactory Bean:

public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = postProcessContext(context) -> {
SecurityConstraint securityConstraint = new SecurityConstraint();
SecurityCollection collection = new SecurityCollection();
tomcat.addAdditionalTomcatConnectors(new Connector[]{this.redirectConnector()});
return tomcat;

private Connector redirectConnector() {
    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    return connector;

Is there a "best practice" method to occomplish the same objective without having to code a Java Bean?

1 reply
Félix Roberto Aballí Morell
hi guys, where can i find some help for spring-data-mongodb ?
1 reply
Lukáš Vasek
Hello, I'm using standard rest controller and inside response body I have OffsetDateTime. The problem is that on same entity for POST endpoint the date is returned only with milliseconds, however for GET also the nanoseconds are returned. Is there some configuration for this to unify it?
1 reply
Question. I have two template pages /index and /login_test. The second one will replace the login page. Until then it's renamed. But login_test is unreachable; Thymeleaf doesn't pick up the template, while index works. What am I doing wrong? I'm using Spring Boot by the way.
login_test also uses some parts from index via th:insert.
1 reply
5 replies
Hi, I am trying to Upgrade Sprinboot Version 1.2.4 to 1.4.1 Release and I am facing the following Error with snakeyaml 1.14 to 1.17
@wilkinsona , Thank you for your reply
Please find the build.gradle, dependencies script in the above image. I am not specifying snakeyaml version anywhere…please guide
Based on te documentation, Springboot 1.4.1.RELEASE comes with SnakeYaml 1.17 Version and that is what I have in the External Libraries
@wilkinsona, got error using gradle with the just-released spring boot 2.6.3, which seems to be caused by spring-boot-loader-tools 2.6.3 not available in plugins.gradle.org
demo$ gradle tC
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'demo'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find org.springframework.boot:spring-boot-loader-tools:2.6.3.
     Searched in the following locations:
       - https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tools/2.6.3/spring-boot-loader-tools-2.6.3.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.3 > org.springframework.boot:spring-boot-gradle-plugin:2.6.3

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

2 replies
I was able to work around it with adding following code to settings.gradle:
pluginManagement {
    repositories {
but a vanilla gradle project generated with start.spring.io would fail to build

Hi booters,
I have a strange behaviour in this simple situation with @RestControllerAdvice:
I defined a custom exception, say:

public class NotFoundException extends RuntimeException {

    private Object[] messageParams;

    public NotFoundException(String message) {

    public NotFoundException(String messageCode, Object... messageParams) {
        this.messageParams = messageParams;

And my controller is:

@RequestMapping(path = "entreprises", produces = MediaType.APPLICATION_JSON_VALUE)
public class EntrepriseApi {

    private final EntrepriseService entrepriseService;

    @GetMapping(path = "/{id}")
    public EntrepriseResponse getEntreprise( @PathVariable UUID id) {
        return entrepriseService.getEntreprise(id); // NotFoundException is thrown here if an entreprise does not exist

The controller advice:

@RestControllerAdvice(basePackageClasses = EntrepriseApi.class)
public class RestAdapterExceptionHandler extends ResponseEntityExceptionHandler {

    private final MessageUtils messageUtils;

    public ExceptionBody handleNotFoundException(NotFoundException ex) {
        return new ExceptionBody(ex.getMessage(), messageUtils.findMessage(ex.getMessage(), ex.getMessageParams()), HttpStatus.NOT_FOUND.value());

The problem is that ExceptionBody handleNotFoundException(NotFoundException ex) method is not invoked when a NotFoundException is thrown.
What did I miss?

Spring Boot version is 2.5.5
It seems like Spring MVC internal exceptions are well catched but mine are not.
Kirill Marchuk

Hi. I was always curious, is it safe to write spring Configuration like that?

  public ProducerFactory<String, String> producerFactory(KafkaContainerFactoryConfig config) {
    return new DefaultKafkaProducerFactory<>(
        config.producerConfigs(), new StringSerializer(), new StringSerializer());

  public KafkaTemplate<String, String> kafkaTemplate(KafkaContainerFactoryConfig config) {
    return new KafkaTemplate<>(producerFactory(config));

would not 2 producerFactories be created in such case? or does Spring allow for some kind of magic to avoid that? or would it be fine to have 2 factories, one as a bean and the other as a "source" for KafkaTemplate (in this case) ?

1 reply
Occasionally such style is present even in Spring documentation (which, I guess, is where this code was copy-pasted from)
Andy Wilkinson
@akuma8 I can't see anything that you've missed. I tried copying your code into a new Spring Boot 2.5.9 project, modifying it slightly to remove the use of MessageUtils and the other classes that you haven't shared. The controller advice is called as expected when the NotFoundException is thrown. I'm happy to dig a bit more, but I'd need to complete yet minimal example that reproduces the problem to be able to do so.
2 replies
Piotr Joński

hi guys i have question about more complex configuration.
my case is that i have 2 starters, starter-db and starter-tenant-management.
starter-db provides interface TenantProvider and default implementation SchemaBasedTenantProvider

STM provides @Primary ActiveTenantProvider implementation as well.

STM depends on SDB.
SDB DOES NOT depend on STM -> no compile class access
i use spring boot 2.6.2

now, i have custom class for DB migrations, to load less beans than usually needed:

// starter-tenant-management configuration is not a compile time dependency (to avoid circular dependency)
// we need ActiveTenantProvider to perform migration only for active tenants
@ComponentScan(basePackages = {"springboot.starter"},
        resourcePattern = "springboot.starter.tenantmanagement.infrastructure.configuration.TenantProviderAutoConfiguration.class")
@ConditionalOnNotWebApplication  // Otherwise, the included spring configuration is added to a microservice's application context
@Profile(Profiles.MIGRATIONS) // To avoid using this application by tests for bootstrap
public class DatabaseMigrationsConsoleApplication implements CommandLineRunner {

and the class TenantProviderAutoConfiguration is not being called in debug mode, sounds like @ComponentScan do not work.

what is the best way to handle such dependencies?

2 replies

Approaches to handle 10 million records of 10 tables each with several joins

I have 10 million records of 10 tables each with several joins. I am looking for the best alternative or DB assign or approach to read the records very quickly that is the query should be fast.

option#1 - normalize the tables, don't go for joins unnecessarily
option#2 - add all the columns in 1st query where multiple times the
where conditions will be used in the looping construct
option#3 - go for nosql database instead of mysql

Please advise


Salman khandu

We have an application that has two dependencies web as well as webflux. All our code is non-blocking except database call( one read call).
Is there any way to run with non-blocking without removing spring-boot-starter-web dependency ( as we have used @ControllerAdvice so if we try to remove web dependencies there will be more code changes)


Thank you

3 replies
Adrian Soria
Is the RestTemplate deprecated? We are only using synchronous calls. Webclient is newer but webflux is needed. We want to avoid to use webflux.
7 replies

After upgrading to Spring Boot 2.6.3 I'm getting cyclic dependency error, which I'm not sure how to fix:

The dependencies of some of the beans in the application context form a cycle:
| securityConfiguration
↑ ↓
| org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration

4 replies


I have an application with default settings defined in /src/main/resources/application.properties (i.e. the classpath root) und custom settings in the file system in $PWD.

This works fine when starting the app from an executable jar. When I use layertools to extract the app (java -Djarmode=layertools -jar application.jar extract), the settings from the classpath root are ignored.

Is this expected behaviour?

17 replies
Josh Wein
Is it possible to have Spring Boot also collect JFR metrics or are those usually looked at separately? We have Spring exporting all our metrics into a micrometer MetricRegistry and I was hoping to ship JFR metrics that way as well to be able to analyze all those metrics in the same place. It seems like JFR is mainly used standalone though
Robert Wiesner
What's the best way to handle java.lang.OutOfMemory Error?
Usually I let it propagate to the JVM/Docker container so the instance get’s killed / restarted.
In my current application this error get’s caught in the Tomcat server of spring boot and I don't know why … any clues?
Hello all
Even though we set the the props like below still we are getting 413 largepayload issue with jacsonmapping exception
Hi. I'd like to use actuator httptrace. Is there a way to one-way hash principal names? Data protection says usernames should not stored plain for analytics purposes.
1 reply
James Howe
This table doesn't make much sense
The columns seem to be "default value" and "description" rather than "replacement" and "reason"
James Howe

I also cannot get the IDEA-Maven integration working, because IDEA apparently cannot run under Java 17 yet, and the new Spring Boot Maven plugin doesn't work on Java 11.

org/springframework/boot/maven/BuildInfoMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Andy Wilkinson
@OrangeDog Thanks. I’ve opened spring-projects/spring-boot#29563 for the change log.
If there isn’t an issue already, it would be worth opening one with JetBrains for the Maven integration problem. Unfortunately, 3.0 is pretty bleeding edge at the moment for exactly this sort of reason. There’s still almost a year for the ecosystem to catch up though.
James Howe
It may be there's an option I'm not seeing to run maven operations with a separate JVM to what the IDE is running in.
Philipp Paul
Hi hi, I have a question to the WebTestClient. By default it seem to use WiretapClientHttpRequest with a WiretapRecorder for the request body. I'm currently writing a controller test for a POST that is streaming a large request body. With the WiretapRecorder active, this means that it is stored in memory and at some point leading to out of heap space exception. How can I configure the webTestClient to use for example ReactorClientHttpRequest which is used by the default webClient (not in a test context) or disable the wiretapRecorder?
3 replies
Hello, is there any way to automatically autowire all dependencies in a spring boot test?
1 reply
Instead of manually specifying them all in the @SpringBootTest(classes = []) annotation?
I have an integration test with a ton of dependencies...
Hi, can I use ObjectFactory again? About my case - I implemented custom scope and overrided get method has passed objectFactory to instantiate bean. It is a different object (of the objectFactory) on each call. Maybe objectFactory is immutable and contains "snapshot" of some data, for example properties from Spring? So if I will store one objectFactory and reuse to recreate bean everytime when properties was changed - I will be using snapshot with old properties?
Virtual Space Snapshot

In my project customer had 1.5.22.Release version of spring boot and now they want to migrate to 2.5.8

is there any guideline or check list for a seamless migration

1 reply
Even Lislebø
hiya. Does anyone know whether spring-boot-actuator supports kotlin reactor coroutines? I'm having a hard time finding anything on it
1 reply