I have a service class, written in spring, with some methods. One of this acts as a restful consumer like below: I want to use Mockito to mock my service, but every method that interacts with restful server instance a new RestTemplate. I’ve to create a static class to Inject it into my service? Answer One of the benefits from
Tag: spring
Using @RequestParam for multipartfile is a right way?
I’m developing a spring mvc application and I want to handle multipart request in my controller. In the request I’m passing MultiPartFile also, currently I’m using @RequestParam to get the file …
`Type cannot be null` exception when trying to run out Stored Procedure using Spring Data JPA
I am trying to invoke a Stored Procedure whose signature looks like the following: CREATE OR REPLACE PROCEDURE FIND_FIRST_BOOKMARK_GT(bookmark IN NUMBER, cur OUT SYS_REFCURSOR) I am using Spring-…
Unexpected empty result using spring query method
I am building an application with a REST API using spring boot and JPA connected to a MySQL database. To search for names in the User class I have implemented a query method: List< User > findByFirstnameLike( String name ); This method only returns a result on an exact match, which is not what I wanted. Have I misunderstood something
java.lang.IllegalArgumentException: Result Maps collection already contains value for
Hey I’m using Mybatis with Spring Annotations. and getting this error: here is the domain class (sans getters and setters): here is my Mapper.Java class lastly here is the Mapper.xml I’m inclined to believe there is something wrong with the xml select statement. Probably with how I am using foreach. I have another mapper using a similar format it just
Calling stored procedure using OUT parameter with Spring Spring JPA 2.*
I am calling a stored procedure using IN parameter – it’s working fine. Need help how to do it for OUT parameters. Answer Refer below link for how to call a stored procedure. https://dzone.com/articles/calling-stored-procedures-from-spring-data-jpa
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
Spring: overriding one application.property from command line
I have an application.properties file with default variable values. I want to be able to change ONE of them upon running with mvn spring-boot:run. I found how to change the whole file, but I only want to change one or two of these properties. Answer You can pass in individual properties as command-line arguments. For example, if you wanted to
How to apply spring security filter only on secured endpoints?
I have the following Spring Security configuration: httpSecurity .csrf() .disable() .exceptionHandling() .authenticationEntryPoint(…
Unable to Send Mail – javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
We are sending Mail using Spring JavaMailSenderImpl. Following is the configuration Properties File :- Console Logs We are convinced that this is not related to the SSL certificate as there are other web applications deployed in the same server which sends email perfectly with the same configuration. What could be the issue here ? Answer You want either mail.smtp.ssl.enable for