Spring boot 3 – Jakarta and Javax

The answer will really depend on which specific libraries you’re using and how they interact with each other, but generally speaking trying to mix Java EE and Jakarta EE them would be a bad idea. As an example, if you’re writing a Spring MVC application then you’ll be using the DispatcherServlet. In Spring Framework 6 … Read more

MapStruct – @Mapper annotation don’t create bean

I resolved the error by doing mvn clean install Also add this to your pom <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration> <source>1.8</source> <target>1.8</target> <annotationProcessorPaths> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> </path> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>${org.mapstruct.version}</version> </path> </annotationProcessorPaths> <compilerArgs> <compilerArg> -Amapstruct.defaultComponentModel=spring </compilerArg> </compilerArgs> </configuration> </plugin>

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

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

why does transaction roll back on RuntimeException but not SQLException

This is defined behaviour. From the docs: Any RuntimeException triggers rollback, and any checked Exception does not. This is common behaviour across all Spring transaction APIs. By default, if a RuntimeException is thrown from within the transactional code, the transaction will be rolled back. If a checked exception (i.e. not a RuntimeException) is thrown, then … Read more

How to generate a dynamic “in (…)” sql list through Spring JdbcTemplate?

Yes, it’s possible in Spring if you use NamedParameterJdbcTemplate or SimpleJdbcTemplate with named parameters. List parameter can be set as a java.util.List: List<String> list = new ArrayList<String>(); list.add(“A”); list.add(“B”); list.add(“C”); List<SomeObject> result = simpleJdbcTemplate.query(“SELECT * FROM t WHERE c in (:list)”, new RowMapper<SomeObject>() { … }, Collections.singletonMap(“list”, list)); In this case Spring internally creates the … Read more

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