Cannot invoke “org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()” because “this.condition” is null

This problem is caused by the new PathPatternParser introduced in Spring Boot 2.6. There are two ways to resolve: As suggested by @gsan in the comment, add following in your application.yml or application.properties: spring.mvc.pathmatch.matching-strategy=ant_path_matcher OR Add the following bean in your config class: import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType; import org.springframework.boot.actuate.endpoint.ExposableEndpoint; import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver; import org.springframework.boot.actuate.endpoint.web.EndpointMapping; … Read more

How to persist LocalDate with JPA?

With JPA 2.2, you no longer need to use converter it added support for the mapping of the following java.time types: java.time.LocalDate java.time.LocalTime java.time.LocalDateTime java.time.OffsetTime java.time.OffsetDateTime @Column(columnDefinition = “DATE”) private LocalDate date; @Column(columnDefinition = “TIMESTAMP”) private LocalDateTime dateTime; @Column(columnDefinition = “TIME”) private LocalTime localTime;

Spring Boot 3 Micrometer Tracing Example

This blogpost from Spring Team will help to set it up: https://spring.io/blog/2022/10/12/observability-with-spring-boot-3 Also, I have come up with a sample Spring Boot 3 + Micrometer project here – https://github.com/kishorek/java/tree/main/spring-observability-demo. I am using Zipkin Brave as distributed tracing implementation. I have created a python service consumed by the Spring boot service. Please refer to the README.

Spring @Bean(name =”name”) vs @Bean @Qualifier(“name”)

Yes there is a difference: @Bean(“foo”) (or @Component(“foo”)) gives your bean the name “foo” in the Spring Context, whereas @Qualifier(“foo”) only adds information without changing the name of the bean. As the bean name is the bean’s unique identifier in the Context, you can only have 1 bean named “foo”, whereas you can have multiple … Read more

Spring security method cannot decide pattern is MVC or not Spring Boot application exception

A migration occurred due to vulnerability CVE-2023-34035. In the event that you get an error like the following: This method cannot decide whether these patterns are Spring MVC patterns or not. If this endpoint is a Spring MVC endpoint, please use requestMatchers(MvcRequestMatcher); otherwise, please use requestMatchers(AntPathRequestMatcher). You should use a complete RequestMatcher. For example, if … Read more

Unable to start LiveReload server

In my case I have two Spring Boot services running simultaneously too. Of course disabling the live-reload completely will work, but there’s also a property you can set to choose a different port. Simply add the following to your application.yml (or properties equivalent). The default is 35729. spring: devtools: livereload: port: 35730

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)