I’m a little confused about correct mvc pattern. This is my config file: In this class I’ve got all Beans. This is my interface UserRepo, and interface UserService. They are the same I’ve got my class that implemets this interface And finally I’ve got my Controller In my Controller I @Autowired UsersRepo/it’s a inteface/. And my code works, I can
Tag: spring-mvc
Spring Boot 2 Multiple Datasource – work only the one with @Primay annotation
I have a problem, I’m trying to use two Oracle databases in spring boot using DataSource, The DataSource wiht the @Primay annotation works fine but the oher one only gives me: I don’t have idea what I should do now. Any help will be welcomed. Thanks! application.properties pom.xml DatabaseConfiguration.java Repository from 1st DB Repository from 2nd DB Answer I could
Login doesn’t work in custom login page for Spring Security
I am having an issue where the custom login page doesn’t appear to be working properly. It sends me to the login?error url, rather than the index page. When using the default Spring Security page, it works exactly as intended. I have placed the code below for the html page and the code dealing with the security and custom page
Why is Spring telling me the controller is an unknown entity upon saving a user?
After a few hours of running against the wall with this code, I’ve just about had it. This error is as indescriptive as can be. My User entity: https://pastebin.com/fqRJmMCc TicketController controller with just the function that holds user info: https://pastebin.com/n7jeciAM User service and repository essentials: https://pastebin.com/acYUF7sN Long story short is that the User object should only need a mail address,
Testing @PreAuthorize annotation with hasAuthority()
I am trying to unit test my apis that have @PreAuthorize annotation. I am getting the cognito groups from the Jwt and using them as authorities. I check the same in the preauthorize annotation in the api methods. UPDATE: I get the 404 No mapping Delete profile/VOlUc3F5A_test.txt exists Test class: Controller method: Answer The error message states that this.mockMvc is
Spring HandlerInterceptor fire and forget
I am wondering what would be the best way to make an HTTP fire and forget web service call inside a HandlerInterceptor (or maybe there is something more suitable). Let’s say I am handling requests and I want to notify some API for each response resulting with HTTP 5XX (by sending the request and response body of the request). Of
I can’t put a HashMap object in the MyBatis parameter
I’m trying use a HashMap object to look up ids and passwords in database, but I can’t. I can only get error message as follows: I set my MyBatis mapper as follows: And, I think it’s ok with my controller and dao, but I’ll attach it. I checked the HashMap variable in the controller and dao correctly print their items.
How to add character ‘s’ on method that have class level @RequestMapping in spring-boot-web
Got class/interface level and method mapping Basically I want to add character ‘s’ on /post and get /posts, how this is possible Answer
Spring Boot jsp file not found Error 404 weird prefix
I am currently learning Spring/Spring Boot and I am trying to code a forgot password function. All my other functions, like login etc. are working as intended, but redirecting to an reset-password page does not work for some reason and gives me the following error, in which it looks for the jsp with a weird prefix. There was an unexpected
Running a Java configured Spring MVC Application fails to load ApplicationContext, raises java.lang.reflect.InaccessibleObjectException
Environment Eclipse IDE for Enterprise Web applications Tomcat 9 Server Code I started learning spring, following a Udemy course (by Chad Darby). In it, a spring mvc app is configured in java. Relevant files are given below: DemoAppConfig.java MySpringMvcDispatcherServletInitializer.java pom.xml Error While running the web app on tomcat 9 server from eclipse, the following exception is raised: Why is it