bean work
This commit is contained in:
parent
8b070d278b
commit
7245aa572a
|
@ -37,7 +37,7 @@
|
|||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>4.2.1.Final</version>
|
||||
<version>4.2.2.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
|
|
|
@ -23,7 +23,7 @@ public class MainWebAppInitializer implements WebApplicationInitializer {
|
|||
|
||||
// Create the 'root' Spring application context
|
||||
final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
|
||||
root.scan("org.baeldung.spring.web.config");
|
||||
root.scan("org.baeldung.spring.config");
|
||||
// root.getEnvironment().setDefaultProfiles("embedded");
|
||||
|
||||
// Manages the lifecycle of the root application context
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
package org.baeldung.web;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BeanA {
|
||||
public class BeanA implements InitializingBean {
|
||||
|
||||
@Autowired
|
||||
private IBeanB b;
|
||||
private IBeanC dependency;
|
||||
|
||||
public BeanA() {
|
||||
super();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package org.baeldung.web;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BeanB1 implements IBeanB {
|
||||
|
||||
public BeanB1() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.baeldung.web;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BeanB2 implements IBeanB {
|
||||
|
||||
public BeanB2() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
|
@ -5,9 +5,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
@Component
|
||||
@Transactional
|
||||
public class BeanB implements IBeanB {
|
||||
public class BeanC implements IBeanC {
|
||||
|
||||
public BeanB() {
|
||||
public BeanC() {
|
||||
super();
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package org.baeldung.web;
|
||||
|
||||
public interface IBeanC {
|
||||
//
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# jdbc.X
|
||||
jdbc.driverClassName=com.mysql.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_01?createDatabaseIfNotExist=true
|
||||
jdbc.user=tutorialuser
|
||||
jdbc.pass=tutorialmy5ql
|
||||
|
||||
# hibernate.X
|
||||
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
|
||||
hibernate.show_sql=false
|
||||
hibernate.hbm2ddl.auto=create-drop
|
|
@ -32,7 +32,7 @@
|
|||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>4.2.1.Final</version>
|
||||
<version>4.2.2.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
|
@ -157,7 +157,7 @@
|
|||
|
||||
<properties>
|
||||
<!-- Spring -->
|
||||
<org.springframework.version>3.2.2.RELEASE</org.springframework.version>
|
||||
<org.springframework.version>3.2.3.RELEASE</org.springframework.version>
|
||||
|
||||
<!-- logging -->
|
||||
<org.slf4j.version>1.7.5</org.slf4j.version>
|
||||
|
@ -169,7 +169,7 @@
|
|||
<mockito.version>1.9.5</mockito.version>
|
||||
|
||||
<httpcore.version>4.2.4</httpcore.version>
|
||||
<httpclient.version>4.2.4</httpclient.version>
|
||||
<httpclient.version>4.2.5</httpclient.version>
|
||||
|
||||
<rest-assured.version>1.8.0</rest-assured.version>
|
||||
<groovy.version>1.8.9</groovy.version>
|
||||
|
|
Loading…
Reference in New Issue