ANSWER: I changed the version tag from 0.0.1-SNAPSHOT to 1.0.2.RELEASE and it worked, see answer below. I am following this documentation and have created the Example.java as instructed. When I run …
Tag: spring-mvc
Why we shouldn’t make a Spring MVC controller @Transactional?
There are already a few questions about the topic, but no response at all really provides arguments in order to explain why we shouldn’t make a Spring MVC controller Transactional. See: Transaction not working correctly – Spring/MyBatis For web MVC Spring app should @Transactional go on controller or service? Making Spring 3 MVC controller method Transactional Spring MVC Controller Transactional
How to fix Hibernate LazyInitializationException: failed to lazily initialize a collection of roles, could not initialize proxy – no Session
In the custom AuthenticationProvider from my spring project, I am trying read the list of authorities of the logged user, but I am facing the following error: org.hibernate….
how to capture connection event in my webSocket server with Spring 4?
I did a simple web socket communication with spring 4,STOMP and sock.js, following this https://github.com/rstoyanchev/spring-websocket-portfolio and this http://assets.spring.io/wp/WebSocketBlogPost.html well, I want to know if is possible capture connection events like when a new client was connected to my server or when a client was disconnected, is that possible in Spring 4.0.0? Answer This an be done with a connection handshake
Converting MultipartFile to java.io.File without copying to local machine
I have a Java Spring MVC web application. From client, through AngularJS, I am uploading a file and posting it to Controller as webservice. In my Controller, I am gettinfg it as MultipartFile and I can copy it to local machine. But I want to upload the file to Amazone S3 bucket. So I have to convert it to java.io.File.
Add context path to Spring Boot application
I am trying to set a Spring Boot applications context root programmatically. The reason for the context root is we want the app to be accessed from localhost:port/{app_name} and have all the …
Removing user login credentials from session when user logout in spring-security
I am new to Spring and Spring-Security. I have been going through the tutorials here The user are not allowed to hit add employee page without login. So if you hit add employee page, you will be directed to the login page and when login succeeded you are directed to the add employee page automatically. But once the user logged
Failed to load Main-Class manifest attribute while running java -jar
I have successfully built my Spring MVC project with mvn clean package by following this tutorial. Now I am trying to run the service with: But I get this error: Failed to load Main-Class manifest attribute from target/gs-serving-web-content-0.1.0.jar Am I missing something? Answer If you are working with Spring Boot this will solve your problem: Reference Guide | Spring Boot
Redirect to an external URL from controller action in Spring MVC
I have noticed the following code is redirecting the User to a URL inside the project, @RequestMapping(method = RequestMethod.POST) public String processForm(HttpServletRequest request, LoginForm …
How to return a text file with Spring MVC?
The string is generated inside the Controller. What I want is to send back to the user a Window where he can save a file which contains the myString. It clearly doesn’t work in this current state and I am stuck at the moment. Answer here is a sample: PS: don’t forget to put some random stuff in your url