Bonjour
Je voudrais intégrer Spring dans mon application gwt , mais je ne trouve pas comment faire l'appel au bean en utilisant les appel rpc
Est ce que quelqu'un pourrait m'indiquer ce que je dois rajouter à mon code pour exécuter les fonctions du serveur tout en gardant spring
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 EnvironmentOrganeServiceImpl extends RemoteServiceServlet implements EnvironmentOrganeService{ @Autowired private HibernateTemplate hibernateTemplate; public List<Contact> getDataOrganisation(){ List<Contact> results=new ArrayList(hibernateTemplate.find("from Contact")); return results; } }
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 <?xml version="1.0" encoding="UTF-8"?> <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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="HelloWorldBean" class="org.me.HelloWorld" /> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" > <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/test"/> <property name="username" value="root"/> <property name="password" value=""/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" > <property name="dataSource" ref="dataSource" /> <property name="annotatedClasses"> <list> <value>test.Contact</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="show_sql"> true</prop> </props> </property> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate" > <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="contactImpl" class="org.me.server.EnvironmentOrganeServiceImpl" > <property name="hibernateTemplate" ref="hibernateTemplate" /> </bean> </beans>
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 public class uiPresenter implements Presenter{ ....... private void InsertOrgData(){ AsyncCallback <List<Contact>> callback = new AsyncCallback<List<Contact>>() { public void onFailure(Throwable caught) { // TODO: Do something with errors. Window.alert("Error fetching Organisation data"); } @Override public void onSuccess(List<Contact> result) { // ( (NavigationArea) westLayout).getProcessusTree().setDataTree(result); display.addOrgTreeData(result); } }; // Make the call to the ListEmployes service. //XmlBeanFactory beanFactory=new XmlBeanFactory(new ClassPathResource("ApplicationContext.xml")); //EnvironmentOrganeServiceImpl myBean=(EnvironmentOrganeServiceImpl)beanFactory.getBean("contactImpl"); rpcService.getDataOrganisation(callback); } .... }
Merci par avance pour vos réposes
Partager