Skip to content

fix: add missing @service spring annotation - #90

Merged
mikededo merged 3 commits into
mainfrom
fix/add_missing_service_annotation
Dec 12, 2022
Merged

fix: add missing @service spring annotation#90
mikededo merged 3 commits into
mainfrom
fix/add_missing_service_annotation

Conversation

@plozanol

Copy link
Copy Markdown
Collaborator

All use cases should be annotated with spring @service, to create a bean component and make them singleton and injectable in other classes.

@plozanol plozanol added status: code review PR ready to be reviewed type: chore Modifies configuration files labels Dec 11, 2022
@plozanol plozanol added this to the 2 - MVP milestone Dec 11, 2022
@plozanol plozanol self-assigned this Dec 11, 2022
@mikededo

Copy link
Copy Markdown
Contributor

Even if they do not use anything related with Jpa, is it required? Just a question

@mikededo mikededo added status: deploy PR ready to be deployed type: bug Something isn't working and removed status: code review PR ready to be reviewed type: chore Modifies configuration files labels Dec 11, 2022
@plozanol

plozanol commented Dec 11, 2022

Copy link
Copy Markdown
Collaborator Author

Yes, it is useful because @Component, @Service, or @Repository are Spring annotations to denote a java bean, a class that once loaded will be reused during the runtime of the application, like a singleton.

Check the code of @Service, is just an alias of @Component:

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Service {
    @AliasFor(
        annotation = Component.class
    )
    String value() default "";
}

@mikededo

Copy link
Copy Markdown
Contributor

Understood! ✅

@mikededo
mikededo merged commit 76289fe into main Dec 12, 2022
@mikededo
mikededo deleted the fix/add_missing_service_annotation branch December 12, 2022 14:18
@mikededo mikededo added status: done PR/Issue completed and removed status: deploy PR ready to be deployed labels Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: done PR/Issue completed type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants