Michele,
This should work for you. It also includes a simple test.
Code:
public class HessianTest {
@Test
public void testHessianConfig() {
ClassPathXmlApplicationContext bf = new ClassPathXmlApplicationContext("hessianTest.xml", getClass());
HessianServiceExporter exporter = (HessianServiceExporter) bf.getBean("/ServerRoles");
IRoleManager service = (IRoleManager)exporter.getService();
assertEquals("role", service.getRole());
}
@Configuration
static class HessianConfig {
@Bean(aliases = { "/ServerRoles" } )
public HessianServiceExporter ServerRoles() {
HessianServiceExporter exporter = new HessianServiceExporter();
exporter.setService(roleManager());
exporter.setServiceInterface(IRoleManager.class);
return exporter;
}
@Bean
public IRoleManager roleManager() {
return new RoleManager();
}
}
static interface IRoleManager {
public String getRole();
}
static class RoleManager implements IRoleManager {
public String getRole() {
return "role";
}
}
}
Here is the Spring hessianTest.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"
>
<beans>
<bean class="org.springframework.config.java.process.ConfigurationPostProcessor"/>
<bean class="HessianTest$HessianConfig" />
</beans>
Hope this helps.
-Arul