2

I'm trying to integrate hibernate with spring, and I asked-just to know if that possible or not-, can I use @Autowired and @Componentscan to do inject the BasicDataSource class?

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911
Ibrahim
  • 77
  • 3
  • 10

1 Answers1

2

With @ComponentScan you can avoid declaring beans by loading them from Java-based configurations. This way, you still need a @Configuration to provide a BasicDataSource dependency.

After the BasicDataSource dependency is scanned, it can be injected in other Spring components using @Autowired or @Inject.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911