@Shalom może wytłumaczę o co mi chodziło, z czym do tej pory w kursie się spotkałem.
Autor kursu stworzył tego typu kod:
@Configuration
public class AppConfig {
@Bean(name = "customerService")
public CustomerService getCustomerService() {
return new CustomerServiceImpl(getCustomerRepository());
}
@Bean(name = "customerRepository")
public CustomerRepository getCustomerRepository() {
return new HibernateCustomerRepositoryImpl();
}
}
ale następnie pokazał, że można wywalić tę konfigurację, jednocześnie dodając stereotype annotations: @Service i @Repository
do odpowiednich klas (@Component
zostało wytłumaczone, ale nigdzie nie użyte), @ComponentScan
oraz @Autowired
tam gdzie to potrzebne. Dzięki @scibi92 za wytłumaczenie