A Restcontroller bean at the same time being a Configuration bean and a Component bean hurts SRP?

Asked

Viewed 24 times

0

In a Java application with Spring I came across a class annotated as follows:

import ...

@Component
@RestController
@Configuration
public class MySender { ... }

At first glance I suspected that doing so certainly violates the principle of Single Responsibility and that it was not good practice. The context of use would be a class that triggers a @Scheduled method for sending a message in a queue, it had no HTTP method. Because I was approved in code Views and I was introduced by a senior dev I was left with doubts about my understanding, but I did not find any reference.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.