Skip to content
Advertisement

Tag: spring

spring security hasAuthority(“SCOPE_xxx”) method not working with spring authorization server version 0.2.0

I have created an authorization server using the new spring authorization server module. I am able to get the token successfully but when I try to use the token against a protected endpoint with hasAuthority() I get forbidden 403 error. Below my pom.xml file Below is my Authorization Server config And this is my Security Config Here is my user

How to configure JmsMessagingTemplate to use MappingJackson2MessageConverter

I am looking at using JmsMessagingTemplate instead of JmsTemplate because I would like to use convertSendAndReceive. The messages should be send in JSON format. I am having difficulties convincing JmsMessagingTemplate to use MappingJackson2MessageConverter instead of the SimpleMessageConverter. The documentation seems to indicate that having a bean for MappingJackson2MessageConverter is enough to have it been used. I created a small reproducing

Do I need synchronize method Scheduled method?

I have a Spring schedulled tasks which calls the same private method. Do I need to sync this method? Will I have the problem if shedulled tasks runned in the same time? Or will be better to extract it to the prototype component or separate schedulled classes or something else? Answer The default ThreadPoolTaskScheduler used by the @Scheduled annotation is,

Replace @PathVariable object with ID only for Springdoc

I am currently trying to migrate from Springfox to Springdoc. Most of my endpoints contain a @PathVariable Instance. Obviously I am only passing in the ID of the instance and Spring would automatically resolve the object for me. Here is an example: Called as /api/myInstance/role. Springfox would handle this correctly for me, only generating {instance} as a String mapping to

What is difference between RequestContextFilter and OncePerRequestFilter in spring?

Spring documentation for Class RequestContextFilter mentions that this filter exposes the request to the current thread, through both LocaleContextHolder and RequestContextHolder. Can someone please explain how this is different from OncePerRequestFilter class, and how can I implement such a filter? Answer You can look at RequestContextFilter source code. It actually extends OncePerRequestFilter and implements the abstract method doFilterInternal to initializes

java model mock response json

I am creating a Rest service which calls an external service. I have this problem: the external service I call responds in two ways depending on the case of Success or Failed. This is json: Well I created 3 simple classes: class XXX… private String result, status; …. getter & setter class Response… private String codiceCase, guidCase; … getter &

How to handle synchronous responses with Spring Cloud Data Flow

We are in the process of designing the migration of our monolithic Java application to microservices to meet various client requirements such as scalability, high availability, etc. The core function of our application is data processing, i.e. retrieve data from a source, put it through 0 or more transformations, and finally push the result to a destination. For this reason,

Override Hysterix Logging

I am trying to understand the logs generated by SpringBoot before and after implementing Hysterix Circuit Breaker Before Hystrix the logs looked like, After implementing Hystrix the logs looks like, So, how did http-nio-8080-exec-2 get replaced with hystrix-OrchestratorController-1, and why it’s not showing my TransactionId when Hystrix got implemented. How did Hystrix take over the logging? What’s the difference between

Advertisement