Skip to content
Advertisement

Tag: spring-mvc

Spring Security – multiple logged users

I have a problem with Spring Security configuration. When I log in on one computer as a user1 and then I will log in as a user2 on another computer, the first computer after refresh sees everything as a user2. In other words, it is impossible to have two sessions with different users at the same time. Configuration: Spring Security

Rest Controller not recognizing GET request in Spring Boot App

I am trying to implement simple demo MVC app with Spring Boot but I get 404 error while executing the application. The uri is `http://localhost:8080/’ which is to display all the rows in a table called circle. Spring Boot : 1.3.3.RELEASE Java Version : 1.8.0_65 Database : Apache Derby 10.12.1.1 Maven Java Project: Application.java CircleController.java CircleRepository.java CircleService.java Circle.java application.properties pom.xml

How to apply Spring Security filter only on secured endpoints?

I have the following Spring Security configuration: The authenticationTokenFilterBean() is applied even on endpoints that do not match /api/** expression. I also tried adding the following configuration code: but this still did not solve my problem. How can I tell Spring Security to apply filters only on endpoints that match the secured URI expression? Answer I have an application with

>> converted to �

One of the application user has reported that they are seeing � instartd of >> on their home and other pages. There are about 100 users and only one user has this issue. The user is using IE11. what may be the cause of this issue. Answer You should have this on top of your jsp files: If you have

Using spring converter in @RequestBody

Is it possible to enforce Converter ( org.springframework.core.convert.converter.Converter) to finish json object mapping? Json code example: where somename – string, id – integer value mapping to : Converter code example: What I want to achieve is to map that json to the object which will have automatically fetched from db nested object. Answer You should implement your own JacksonCustomMapper, by

What will happen if we interchange @service and @repository annotation in the spring MVC

Why we needs to use @service inside the service Implementation and @repository in the DAO Implementation. There are no problem occur when I interchange the @service and @repository annotation in the spring MVC. Answer According to documentaion @Repository,@Service,@Controller are all synonyms. They all are just specializations of @Component annotation. So, generally, they can be used one instead of other. But

HTTP Status 405 – Request method ‘PUT’ not supported

I have the following controller: Here is my calls from the PostMan. First I am making the GET call to get all the restaurants and it works fine Second I am trying to update the object by I am getting the following error. At the Tomcat 8.0.32, I am getting the following log: 13-Feb-2016 16:55:09.442 WARNING [http-apr-8080-exec-9] org.springframework.web.servlet.PageNotFound.handleHttpRequestMethodNotSupported Request method

Spring Boot @ExceptionHandler hide Exception Name

I am using Spring Boot 1.3.X and have the following: Which works as expected. When passing a wrong param, the following exception is raised: I then created an ExceptionHandler as seen below: Which raises the following Exception: Is it possible to exclude the exception field from the JSON representation? Answer You can get the Error Attributes in your controller advice

How to re-create database before each test in Spring?

My Spring-Boot-Mvc-Web application has the following database configuration in application.properties file: this is the only config I made. No any other configurations made by me anywhere. Nevertheless the Spring and subsystems are automatically recreate database on each web application run. Database is recreated namely on system run while it contains data after application ends. I was not understanding this defaults

Advertisement