Application-Gateway icon indicating copy to clipboard operation
Application-Gateway copied to clipboard

Implement Bean Naming Schema

Open gianlucafrei opened this issue 4 years ago • 2 comments

Currently we have a bit of anarchy when it comes to bean naming convention. We should implement the following approach for all types of beans (shortName + postfix from variable in interface):

public interface UserMappingFactory {

    /**
     * Name postfix for beans of this type.
     */
    String USER_MAPPER_TYPE_POSTFIX = "-userMapping-factory";

   [...]
}

@Component("jwt-mapping" + USER_MAPPER_TYPE_POSTFIX)
public class JwtTokenMapperFactory implements UserMappingFactory {
    [...]
}

gianlucafrei avatar May 26 '21 16:05 gianlucafrei

Why not just use the default naming strategy from Spring? (see https://www.baeldung.com/spring-bean-names#1-class-level-annotations) If the classes are named accordingly the post fix can be achieved without any string constants in the interface

groscy avatar Apr 16 '22 20:04 groscy

Proposal done, but no rights to push on repo

groscy avatar Apr 17 '22 01:04 groscy

Proposal looks good, sorry it took us so long. I missed your PR. The notification got stuck in my Spam folder. I'm working to include your proposal and make sure the documentation is in line with the changes too.

Padi-owasp avatar Jan 27 '24 13:01 Padi-owasp