Skip to content

spring-injection:InjectablesMustNotBeInstantiated false-positive when using helper methods #104

@janmaterne

Description

@janmaterne

When a @bean method in configuration class uses a helper method to create the injectable, that helper method is marked as invalid.

@Configuration
public class MyConfig {

    @Bean RestTemplate myService() {
        return createRestTemplate("http://baseurl");
    }

    // this is marked as error with "jQAssistant Spring Plugin <unknown version> [jqa.plugin.spring]", should be 2.1.0
    private RestTemplate createRestTemplate(String baseurl) {
        var template = new RestTemplate();
        // standard configuration + baseurl
        return template;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions