春の豆
パケットスキャンで指定@Component @Controller @Service @Respositoryクラス@ComponentScan
あなたのプロパティ/コンストラクタ/ setメソッドで、Beanを自動的に注入し@Autowired
パッケージcom.example.service。 輸入org.springframework.beans.factory.annotation.Autowired; 輸入org.springframework.stereotype.Service。 @Service パブリック クラス DatabaseAccountServiceは実装AccountServiceの{ 民間 最終RiskAssessor riskAssessorを。 @Autowired 公共DatabaseAccountService(RiskAssessor riskAssessor){ この .riskAssessor = riskAssessor。 } // ... }