Jersey returns 404 with any error status code?

The default behavior with Jersey, when there is an error status (4xx, 5xx), is to use the servlet’s Response.sendError, which results in a redirect to an error page. Since there is no error page set up, it results in a 404. We can change this behavior by setting the Jersey property ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR You can do … Read more

Disable Logback in SpringBoot

Add exclusion to both the spring-boot-starter and spring-boot-starter-web to resolve the conflict. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency>

Spring Boot & JPA: Implementing search queries with optional, ranged criteria

You can achieve complex queries with specifications by JpaSpecificationExecutor in spring data. Repository interface must extend the JpaSpecificationExecutor<T> interface so we can specify the conditions of our database queries by creating new Specification<T> objects. The trick is in the use of the Specification interface in combination with a JpaSpecificationExecutor. here is the example: @Entity @Table(name … 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

Springboot Security hasRole not working

You have to name your authority with prefix ROLE_ to use isUserInRole, see Spring Security Reference: The HttpServletRequest.isUserInRole(String) will determine if SecurityContextHolder.getContext().getAuthentication().getAuthorities() contains a GrantedAuthority with the role passed into isUserInRole(String). Typically users should not pass in the “ROLE_” prefix into this method since it is added automatically. For example, if you want to determine … Read more

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