Why is there no spring-asm-3.2.4.RELEASE jar?
Here is from release notes for 3.2 we’ve eliminated the dedicated spring-asm jar in M2 in favor of including org.springframework.asm classes directly in spring-core
Here is from release notes for 3.2 we’ve eliminated the dedicated spring-asm jar in M2 in favor of including org.springframework.asm classes directly in spring-core
Two of your options: Use th:utext – easy setup option, but harder to read and remember Create a custom processor and dialect – more involved setup, but easier, more readable future use. Option 1: You can use th:utext if you escape the text using the expression utility method #strings.escapeXml( text ) to prevent XSS injection … Read more
If you want to dynamically schedule tasks you can do it without spring by using ExecutorService in particular ScheduledThreadPoolExecutor Runnable task = () -> doSomething(); ScheduledExecutorService executor = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors()); // Schedule a task that will be executed in 120 sec executor.schedule(task, 120, TimeUnit.SECONDS); // Schedule a task that will be first run in 120 sec … Read more
@Oleksandr’s answer is correct, but the only way I could get it to work is as follows. I’m using Eclipselink on PostgreSQL. public interface UserRepository extends JpaRepository<User, Long> { @Query(“SELECT CASE WHEN COUNT(u) > 0 THEN ‘true’ ELSE ‘false’ END FROM User u WHERE u.username = ?1”) public Boolean existsByUsername(String username); }
Is it possible to use Hibernate and Mysql with ReactiveCrudRepository instead of CrudRepository? TL;DR: Not with Hibernate and MySQL, but with R2DBC and Postgres, Microsoft SQL Server or H2. Take a look at Spring Data R2DBC. Long Version Why not JPA? With Hibernate/JPA included this won’t happen in the foreseeable future. JPA is based on … Read more
First, you have to specify the constructor arg in your bean definition, and not in your injection points. Then, you can utilize spring’s @Value annotation (spring 3.0) @Component public class DefaultInterfaceParameters { @Inject public DefaultInterfaceParameters(@Value(“${some.property}”) String value) { // assign to a field. } } This is also encouraged as Spring advises constructor injection over … Read more
The issue can be a conflict between a java version and a javaassist version. If you’re using the java 8 on your server you should make sure to use the latest javassist version as well. This blog shows the origin of a conflict being inside the thymeleaf which pulls in an older javassist, the solution … Read more
<bean class=”org.springframework.oxm.jaxb.Jaxb2Marshaller”> <property name=”classesToBeBound”> <list> …. </list> </property> <property name=”marshallerProperties”> <map> <entry> <key> <util:constant static-field=”javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT” /> </key> <value type=”java.lang.Boolean”>true</value> </entry> </map> </property> </bean>
Spring does not support @javax.validation.Valid on @PathVariable annotated parameters in handler methods. There was an Improvement request, but it is still unresolved. Your best bet is to just do your custom validation in the handler method body or consider using org.springframework.validation.annotation.Validated as suggested in other answers.
To set the read and connect timeout I use the method below, because the SO_TIMEOUT option is not available for channels using NIO (and giving the warning Unknown channel option ‘SO_TIMEOUT’ for channel ‘[id: 0xa716fcb2]’) ReactorClientHttpConnector connector = new ReactorClientHttpConnector( options -> options.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 2000) .compression(true) .afterNettyContextInit(ctx -> { ctx.addHandlerLast(new ReadTimeoutHandler(5000, TimeUnit.MILLISECONDS)); })); return WebClient.builder() .clientConnector(connector) … Read more