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 argume…
Tag: spring
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 endp…
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 cou…
How to serialize nested ObjectId to String with Jackson?
There are many questions concerning conversion from ObjectId to String with jackson. All answers suggest either creating own JsonSerializer<ObjectId> or annotating the ObjectId field with @JsonSerialize(using = ToStringSerializer.class). However, I have a map that sometimes contains ObjectIds, i.e.: I w…
Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found
I work with Spring and Hibernate and I used Oracle 11g as database and I used JBoss 5. I have a problem to re-establish the connection automatically I used c3p0-0.9.1.1.jar This my config in my application : But I have this error : my application works correctly using the previous database configuration but m…
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 au…
Maven spring boot run debug with arguments
Usually I’m running my Spring Boot application with command: I want to set custom port to debug, so I can connect from eclipse. When I add arguments from example https://docs.spring.io/spring-boot/docs/1.1.2.RELEASE/maven-plugin/examples/run-debug.html it works but other arguments like server.port or pa…
Spring boot Active Directory/LDAP connection
I already connect with AD from spring boot for login purposes but i can not mak searches. My configuration is So, when i call the function getUserDetails() from controller it returns “Templates is null” Answer I solved the problem thanks all for your help and into the controller i put as you can s…
Spring Boot init.d not Not running (process not found)
I was trying to follow the instructions from here, where trying to run the Spring Boot app as init.d service but could not successfully. I created the fully executable jar (myapp.jar) as mentioned and also created the symlink to /etc/init.d/myapp When I run the java -jar myapp.jar I could see the application …
Overriding beans in Integration tests
For my Spring-Boot app I provide a RestTemplate though a @Configuration file so I can add sensible defaults(ex Timeouts). For my integration tests I would like to mock the RestTemplate as I dont want to connect to external services – I know what responses to expect. I tried providing a different impleme…