File tree Expand file tree Collapse file tree 7 files changed +22
-13
lines changed
Expand file tree Collapse file tree 7 files changed +22
-13
lines changed Original file line number Diff line number Diff line change 77import org .springframework .beans .factory .annotation .Autowired ;
88import org .springframework .context .annotation .Bean ;
99import org .springframework .context .annotation .ComponentScan ;
10- import org .springframework .context .annotation .Configuration ;
1110import org .springframework .context .annotation .PropertySource ;
1211import org .springframework .core .env .Environment ;
1312import org .springframework .dao .annotation .PersistenceExceptionTranslationPostProcessor ;
1817
1918import com .google .common .base .Preconditions ;
2019
21- @ Configuration
20+ // @Configuration
2221@ EnableTransactionManagement
2322@ PropertySource ({ "classpath:persistence-mysql.properties" })
2423@ ComponentScan ({ "org.baeldung.spring.persistence.dao" , "org.baeldung.spring.persistence.service" })
Original file line number Diff line number Diff line change 11package org .baeldung .spring .config ;
22
3+ import org .springframework .beans .factory .BeanFactory ;
4+ import org .springframework .beans .factory .annotation .Autowired ;
35import org .springframework .context .annotation .ComponentScan ;
46import org .springframework .context .annotation .Configuration ;
57import org .springframework .web .servlet .config .annotation .EnableWebMvc ;
1012@ ComponentScan ("org.baeldung.web" )
1113public class WebConfig extends WebMvcConfigurerAdapter {
1214
15+ @ Autowired
16+ BeanFactory beanFactory ;
17+
1318 public WebConfig () {
1419 super ();
1520 }
1621
17-
18-
1922}
Original file line number Diff line number Diff line change 11package org .baeldung .web ;
22
33import org .springframework .stereotype .Component ;
4+ import org .springframework .transaction .annotation .Transactional ;
45
56@ Component
7+ @ Transactional
68public class BeanA {
79
8- private IBeanC dependency ;
9-
1010 public BeanA () {
1111 super ();
1212 }
1313
14- //
15-
1614}
Original file line number Diff line number Diff line change 11package org .baeldung .web ;
22
3+ import org .springframework .beans .factory .annotation .Autowired ;
34import org .springframework .stereotype .Component ;
5+ import org .springframework .transaction .annotation .Transactional ;
46
57@ Component
6- public class BeanB implements IBeanB {
8+ @ Transactional
9+ public class BeanB {
10+
11+ @ Autowired
12+ private BeanA beanA ;
713
814 public BeanB () {
915 super ();
Original file line number Diff line number Diff line change 33import org .springframework .stereotype .Component ;
44
55@ Component
6- public class BeanC2 implements IBeanB {
6+ public class BeanC2 implements IBeanC {
77
88 public BeanC2 () {
99 super ();
Original file line number Diff line number Diff line change 1+ package org .baeldung .web ;
2+
3+ public interface IBeanA {
4+ //
5+ }
Original file line number Diff line number Diff line change 44 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
55 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd" >
66
7- <bean id =" beanA" class =" org.baeldung.web.BeanA" >
8- <property name =" beanC" ref =" beanC" />
9- </bean >
7+ <!-- <bean id="beanA" abstract="true" class="org.baeldung.web.BeanA" /> -->
108
119</beans >
You can’t perform that action at this time.
0 commit comments