Announcement Announcement Module
Collapse
No announcement yet.
Call service method via interface Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Call service method via interface

    Hello everyone,

    I have problem with following scenario.
    Let's say I got interface ...
    Code:
    public interface Test {
    
    	public String method();
    
    }
    ... and simple implementation annotated as service component.
    Code:
    @Service
    public class TestImpl implements Test {
    
    	@Override
    	public String method() {
    		return "doing business logic ...";
    	}
    
    }
    I would like to call method from my flow via interface like presented below:
    Code:
    ...
    <on-render>
    	<evaluate expression="test.method()" result="requestScope.res" />
    </on-render>
    ...
    But unfortunately it doesn't work and throws exception:
    org.springframework.expression.spel.SpelEvaluation Exception: EL1008Epos 0): Field or property 'test' cannot be found on object of type 'org.springframework.webflow.engine.impl.RequestCo ntrolContextImpl'

    I can also add that case below work correctly, Spring autowires interface field with TestImpl object.
    Code:
    @Controller
    public class TestController {
    
    	@Autowired
    	private Test test;
    
    	@RequestMapping(value = "/test")
    	public String test() {
    		System.out.println(test.method());	   //prints: doing business logic ...
    		return "test";
    	}
    
    }
    Calling method in flow directly on class object like testImpl.method() works fine, but I would like to know if it could be done with interface? I couldn't find any clue in documentation so maybe someone here met similar problem.
    Thanks in advance.
    Daniel
Working...
X