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

Spring Boot 2.1.0 with Flyway 4.2.0

I had the same problem with PostgreSQL 9.2, and used the following class to solve the problem. Be aware though that all the custom properties you might set in the Spring Boot properties will be ignored, since that replaces the whole Flyway autoconfiguration by your own. So you might have to add some additional code … Read more

How to disable csrf in Spring using application.properties?

As the WebSecurityConfigurerAdapter uses an imperative approach you can inject the value of the security.enable-csrf variable and disable CSRF when it be false. You are right, I think this should work out of the box. @Configuration public class AuthConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsService userDetailsService; @Value(“${security.enable-csrf}”) private boolean csrfEnabled; @Override protected void configure(AuthenticationManagerBuilder auth) … Read more

Configuring base package for component scan in Spring boot test

Good to add the test config above I have the following in test config and any test case. I am new to spring boot test but it work. Let me know, if I am wrong. @Configuration @ComponentScan(“au.some.spring.package”) public class TestConfig { } @RunWith(SpringRunner.class) @EnableAutoConfiguration @SpringBootTest(classes= TestConfig.class) @TestPropertySource({“classpath:application.yml”, “classpath:env-${testing.env}.properties”}) public class DBDmoTest { @Autowired PartyRepository partyRepository; … Read more

Springboot – validate @RequestBody

Add @NotNull annotation on a field (you may need to change type to Integer), and add @Valid annotation on the method parameter of the controller. Mono<String> question(@Valid @RequestBody Foo foo) { … } public class Foo { @NotNull private Integer important; private String something; //constructors, getter, seters, toString } You can find more information here: … Read more

Excluding Lombok classes from Sonar coverage report

As mentionned here : https://github.com/jacoco/jacoco/pull/513#issuecomment-293176354 filtering is performed at a time of report generation (creation of html, xml, etc), not at a time of collection of execution information (creation of exec file). So that tools that read execution data directly instead of reading of xml (which is a kind of mistake on their side to … Read more

org.postgresql.util.PSQLException: ERROR: relation “app_user” does not exist

PostgreSQL is following the SQL standard and in that case that means that identifiers (table names, column names, etc) are forced to lowercase, except when they are quoted. So when you create a table like this: CREATE TABLE APP_USER … you actually get a table app_user. You apparently did: CREATE TABLE “APP_USER” … and then … Read more