Hi everybody,
we decide to use a custom set of configuration mapped on db with a custom structure.
So I decide to use a custom annotation like this:
and another annotationCode:@Service @Retention(RetentionPolicy.RUNTIME) public @interface ConfigurationNode { String path(); String key(); }
I annotated a field on my bean:Code:@Service @Retention(RetentionPolicy.RUNTIME) public @interface DbConfig { }
All i want to do is intercept my annotation and putting the correct value during bean injection.Code:@DbConfig @Transactional public class TestDao { Logger logger = LoggerFactory.getLogger(TestDao.class); @Autowired FolderDao folderDao; @Autowired NodeDao nodeDao; @ConfigurationNode(path = "CBOX/WEBAPP/WEBAPP/WEBAPP", key = "size") Node test;
So i think to build a factory.
There is a way to pass to my @Bean annotation the parameter of my custom annotation?Code:@Configuration public class DBConfigurationScanContext { @Bean Object getObject(String path, String key){ return new Object(); } }
Or there is a more efficent way to build a custom bean?


Reply With Quote