why spring-boot application doesn’t require @EnableWebMvc

@SpringBootApplication is a convenience annotation that adds all of the following: @Configuration tags the class as a source of bean definitions for the application context. @EnableAutoConfiguration tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings. Normally you would add @EnableWebMvc for a Spring MVC app, but Spring … Read more

Multiple Spring @Scheduled tasks simultaneously

You should use TaskScheduler for your purpose @Bean public ThreadPoolTaskScheduler threadPoolTaskScheduler() { ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler(); threadPoolTaskScheduler.setPoolSize(THREADS_COUNT); return threadPoolTaskScheduler; } Where THREADS_COUNT – total count of tasks which should be executed in parallel. If I understand you correctly, you have only 2 jobs, so you need 2 threads

spring-boot: Fatal error compiling: invalid target release: 17

You should check which Java version is configured in the JAVA_HOME. Use: mvn -version You should see something like this from mvn output $ mvn -version Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) Maven home: path\apache-maven-3.8.5 Java version: 17.0.3.1, vendor: Oracle Corporation, runtime: path\Java\jdk-17.0.3.1 Default locale: en_US, platform encoding: Cp1252 OS name: “windows 10”, version: “10.0”, arch: “amd64”, … Read more

Difference between Spring and Spring Boot

In short Spring Boot reduces the need to write a lot of configuration and boilerplate code. It has an opinionated view on Spring Platform and third-party libraries so you can get started with minimum effort. Easy to create standalone applications with embedded Tomcat/Jetty/Undertow. Provides metrics, health checks, and externalized configuration. You can read more here … Read more

Spring Boot can’t autowire @ConfigurationProperties

This is expected as @ConfigurationProperties does not make a class a Spring Component. Mark the class with @Component and it should work. Note that a class can only be injected if it is a Component. Edit: From Spring 2.2+ (Reference) @ConfigurationProperties scanning Classes annotated with @ConfigurationProperties can now be found via classpath scanning as an … Read more

Spring Boot 2.4.2 – DNS Resolution Problem at start on Apple M1

I needed a version in addition to classifier: <dependency> <groupId>io.netty</groupId> <artifactId>netty-resolver-dns-native-macos</artifactId> <scope>runtime</scope> <classifier>osx-x86_64</classifier> <version>4.1.59.Final</version> </dependency> scope is optional but classifier is required. For the latest version, see: https://mvnrepository.com/artifact/io.netty/netty-resolver-dns-native-macos Example: Latest version for M1 macs (aarch_64), as of 2022-01: <classifier>osx-aarch_64</classifier> <version>4.1.72.Final</version>

Updating to Spring Security 6.0 – replacing Removed and Deprecated functionality for securing requests

In Spring Security 6.0, antMatchers() as well as other configuration methods for securing requests (namely mvcMatchers() and regexMatchers()) have been removed from the API. An overloaded method requestMatchers() was introduced as a uniform mean for securing requests. The flavors of requestMatchers() facilitate all the ways of restricting requests that were supported by the removed methods. … Read more