How to run Swagger 3 on Spring Boot 3

I had given up and went to use Spring Boot 2.7 after posting the question. But, after seeing Dmitriy’s answer though, I checked Springdoc one last time and found that Springdoc v2 does support Spring Boot 3. Essentially, one has to place the following in their pom: <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.0</version> </dependency> Then one can … Read more

Spring Boot java.lang.NoClassDefFoundError: javax/servlet/Filter

for the maven users, comment the scope provided in the following dependency: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <!–<scope>provided</scope>–> </dependency> UPDATE As mentioned you have to uncomment the provided part depending on what kind of app you are deploying. Here is a useful link with the details:

Certificate for doesn’t match any of the subject alternative names

You need to provide localhost as a subject alternative name when creating your certificate. You can do that by provide the following additional parameter: -ext “SAN:c=DNS:localhost,IP:” So something like this: keytool -genkeypair -keyalg RSA -keysize 2048 -alias stackoverflow \ -dname “CN=stackoverflow,OU=Hakan,O=Hakan,C=NL” \ -ext “SAN:c=DNS:localhost,IP:” -validity 3650 \ -storepass <password> -keypass <password> \ -keystore identity.jks -deststoretype … Read more

How can I Stop/start/Pause a @JmsListener (the clean way)

Here is the solution I’ve found @RestController @RequestMapping(“/jms”) public class JmsController { @Autowired ApplicationContext context; @RequestMapping(value=”/halt”, method= RequestMethod.GET) public @ResponseBody String haltJmsListener() { JmsListenerEndpointRegistry customRegistry = context.getBean(“jmsRegistry”, JmsListenerEndpointRegistry.class); customRegistry.stop(); return “Jms Listener Stopped”; } @RequestMapping(value=”/restart”, method=RequestMethod.GET) public @ResponseBody String reStartJmsListener() { JmsListenerEndpointRegistry customRegistry = context.getBean(“jmsRegistry”, JmsListenerEndpointRegistry.class); customRegistry.start(); return “Jms Listener restarted”; } @RequestMapping(value=”/stopApp”, method=RequestMethod.GET) public … Read more

Spring Boot : Custom Validation in Request Params

Case 1: If the annotation ValuesAllowed is not triggered at all, it could be because of not annotating the controller with @Validated. @Validated @ValuesAllowed(propName = “orderBy”, values = { “OpportunityCount”, “OpportunityPublishedCount”, “ApplicationCount”, “ApplicationsApprovedCount” }) public class OpportunityController { @GetMapping(“/vendors/list”) public String getVendorpage(@RequestParam(required = false) String term,..{ } Case 2: If it is triggered and throwing … Read more

KeyCloak Server Caused by: java.lang.ClassNotFoundException:

After some research I found the answer to my problem. The problem is that is being deprecated since JRE 9 and marked for removal in future versions. is being replaced by I was running my Spring-Boot application on JRE 14 in which this class appeared to be no longer available. So once … Read more

about spring boot how to disable web environment correctly

Starting from Spring Boot 2.0 -web(false)/setWebEnvironment(false) is deprecated and instead Web-Application-Type can be used to specify Application Properties spring.main.web-application-type=NONE # REACTIVE, SERVLET or SpringApplicationBuilder @SpringBootApplication public class SpringBootDisableWebEnvironmentApplication { public static void main(String[] args) { new SpringApplicationBuilder(SpringBootDisableWebEnvironmentApplication.class) .web(WebApplicationType.NONE) // .REACTIVE, .SERVLET .run(args); } } Where WebApplicationType: NONE – The application should not run as a … Read more