Can @ Resource inject the bean of the @ Bean annotation?

in a class

@Configuration
public class MyConfig{

    @bean"d1"  
    Datasource getDataSource(){
        DruidDataSource d1 = new DruidDataSource();
        ...
        return d1;
    }
}

then in another class:

@Configuration
public class SecondConfig{
    @Resource(name="d1")
    Datasource dataSource;
    ...
    
    

}

found that it doesn"t work, why?

Apr.09,2021

    @bean 
    Datasource d1(){
        DruidDataSource d1 = new DruidDataSource();
        ...
        return d1;
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eabd7c-208c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eabd7c-208c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?