0
クラスをHashMapに配置したいですか?そのために、私は@ServiceでBeanを作成しました。これです:Springブート - 手動でBeanを作成してハッシュマップに渡す方法
@Service
public class ServiceManagerImpl implements ServiceManager {
@Override
public void registerService() {
// registerService will put this in the HashMap!
dispatcher.registerService("serviceList", getServiceListImpl());
}
@Bean
public BusinessService getServiceListImpl() {
return new ServiceListManager();
}
}
これは正しい方法ですか?
を見てみましょう_BeanCreatinException_をスローします。あなたは_moveをメインクラスとどういう意味ですか?私にとっては明らかではない。 – MissBonbon
あなたのアプリケーションのエントリーポイントはどれですか?あなたの主な方法はどこですか? ここを見てくださいhttp://stackoverflow.com/questions/29146019/where-to-put-bean-in-spring-boot?rq=1 –
ありがとう、今私は知っている、あなたが意味すること...そしてBeanをアプリケーション・コンテキストで動的にロードしたいとき、私は何をしなければなりませんか?その後、設定ファイルは動作しません。 – MissBonbon