Salut à tous,

j'ai un petit probléme de configuration on dirait.
Des que je lance mon application de test permettant de verifier le bon fonctionnement de la partie spring hibernate,il n'arrive pas à trouver le bean spingTestService

Voici le code :

[Main.java]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
public class Main {
 
    /** Creates a new instance of Main */
    public Main() {
    }
    static public void  main(String[] args) {
        try{
            Personne personne = new Personne("nom", "prenom", "rue toto", 75001d);
            ApplicationContext context = new ClassPathXmlApplicationContext(new String("*.xml"));
            TestServiceImpl service = (TestServiceImpl) context.getBean("springTestService");
            service.Service(personne);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
[appContext.xml]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
<!-- CONFIGURATION SPRING -->
 
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
       http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
 
    <!-- service test --><!--setHibernateDao(de l'objet testHibernateDao)-->
    <bean id="springTestService" class="TestServiceImpl">
        <property name="hibernateDao" ref="testHibernateDao"/>
    </bean>
 
    <!-- hibernate dao --><!--setSessionFactory(de l'objet mysessionFactory)-->
    <bean id="testHibernateDao" class="TestHibernateDao">
        <property name="sessionFactory" ref="mySessionFactory" />
    </bean>
 
 
    <!-- configuration datasource & sessionFactory -->
    <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource">
            <ref bean ="myDataSource"/>
        </property>
        <property name="annotatedClasses">
            <list>
                <value>Personne</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <map>
                <entry key="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
                <entry key="hibernate.show_sql" value="true" />
                <entry key="hibernate.hbm2ddl.auto" value="update" />
            </map>
        </property>
    </bean>
 
 
    <bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
        <property name="url" value="jdbc:hsqldb:hsql://localhost/DB" />
        <property name="username" value="sa" />
        <property name="password" value="" />
    </bean>
 
</beans>
[faces-config.xml]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
<?xml version='1.0'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
 
<!-- CONFIGURATION JSF -->
 
 
<faces-config>
    <managed-bean>
        <managed-bean-name>controleurpers</managed-bean-name>
        <managed-bean-class>ControleurPersonne</managed-bean-class>
        <managed-property>
            <property-name>springTestService</property-name>
            <value>#{springTestService}</value>
        </managed-property>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <application>
        <variable-resolver>
            org.springframework.web.jsf.DelegatingVariableResolver
        </variable-resolver>
        <locale-config />
    </application>    
    <lifecycle/>
    <factory/>
</faces-config>
[web.xml]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>        
    </context-param>
 
    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
 
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param>
 
    <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>false</param-value>
    </context-param>
 
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener> 
 
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/appContext.xml</param-value>
    </context-param>    
 
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
 
    <servlet>
        <servlet-name>SpringContextServlet</servlet-name>
        <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
 
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    
    <welcome-file-list>
        <welcome-file>faces/index.jsp</welcome-file>
    </welcome-file-list>
    
    <jsp-config>
        <jsp-property-group>
            <url-pattern>*.jspf</url-pattern>
            <is-xml>true</is-xml>
        </jsp-property-group>
    </jsp-config>
</web-app>
S'il vous manque des informations,n'hésitez pas

Merci de votre aide