How to solve the problem that IDEA will report an error (red cross) when using aliases in xxmapper.xml?

1, problem
when I use the alias IDEA of the entity in Mapper.xml, there will be a red cross, while using full path will not report an error. is this IDEA"s problem? How to solve the problem?


2, my configuration
application.xml:

-sharp [Mybatis]
-sharp 
mybatis.type-aliases-package=com.freedom.clothing.domain

DataSourceConfig.xml

    @Bean
    public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
        sqlSessionFactoryBean.setDataSource(dataSource());
        //
        sqlSessionFactoryBean.setTypeAliasesPackage("com.freedom.clothing.domain");

        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        // Mapper.xml
        sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/*.xml"));

        return sqlSessionFactoryBean.getObject();
    }

Match class

@Setter
@Getter
public class Match {
    
    private Integer id;

    private Integer userId;

    private Integer groupId;

    //
    private List<MatchItem> matchItems;
    //
    private List<Tag> tags;

    private Boolean isPublish;

    private Boolean isDel;

    public Integer getId() {
        return id;
    }
}
Apr.07,2021

some plug-ins you install in idea will cause aliases not to be automatically recognized in the xxmapper.xml file. Click the File-> Settings menu, or Ctrl + Alt + S shortcut key. Open the settings panel. And switch to the Plugins plug-in, and check the show drop-down box to check Custom, to disable or uninstall your own installed plug-ins. I used to MybatisX this plug-in caused this problem, you can give it a try, the pure version of idea will not report an error again.


this should be the prompt of the plug-in. Idea will not automatically detect this error. Just remove this prompt

.
Menu