How to log request and response bodies in Spring WebFlux

This is more or less similar to the situation in Spring MVC. In Spring MVC, you can use a AbstractRequestLoggingFilter filter and ContentCachingRequestWrapper and/or ContentCachingResponseWrapper. Many tradeoffs here: if you’d like to access servlet request attributes, you need to actually read and parse the request body logging the request body means buffering the request body, … Read more

JSP file not rendering in Spring Boot web application

Make sure that your pom.xml specifies the Tomcat JSP dependency as follows: <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency> It seems that embedded Tomcat treats the JSP rendering as optional. As mentioned below, this JAR is sometimes necessary as well: <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <scope>provided</scope> </dependency> (I added provided since this JAR should be included by the servlet … Read more

Spring Security: Upgrading the deprecated WebSecurityConfigurerAdapter in Spring Boot 2.7.0

I have managed to update the methods. This is the WebSecurityConfig class, and the methods are modified in the following way: public void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception { authenticationManagerBuilder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); } has become: @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); } Explanation: In the old version you inject AuthenticationManagerBuilder, set userDetailsService, passwordEncoder and … Read more

@EnableTransactionManagement in Spring Boot

Probably you’re also using Spring Data. Calls on Spring Data repositories are by default surrounded by a transaction, even without @EnableTransactionManagement. If Spring Data finds an existing transaction, the existing transaction will be re-used, otherwise a new transaction is created. @Transactional annotations within your own code, however, are only evaluated when you have @EnableTransactionManagement activated … 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 feed.me 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: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging

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