I am facing with the next problem, when I am trying to pass the User to the service method using SpEL,
evaluate expression="commonService.userTest(user)" result="flowScope.user"
spring throws me the following exception:
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 14): Method call: Method userTest(com.x.domain.common.User) cannot be found on com.sun.proxy.$Proxy114 type
But when I am passing a plain text instead of the User object,
evaluate expression="commonService.userTest('Hello')" result="flowScope.user"
There are no errors.
@Entity
@Table(name = "users")
@Getter
@Setter
@NoArgsConstructor
@Slf4j
public class User extends BaseEntity implements UserDetails {
@Column(unique = true)
@NotEmpty
private String username;
@Column
@NotEmpty
@Size(min = 5)
private String password;
}
@Service("commonService")
public class CommonServiceImpl implements CommonService {
@Transactional(readOnly = true)
@Override
public User userTest(String name) {
User user = createUser();
user.setUsername(name);
return user;
}
@Transactional(readOnly = true)
@Override
public User userTest(User user) {
return user;
}
}
Update #2 - Workaround
Removing DevTools dependency solved the problem, but applying this solution Spring Boot Dev Tools & Web Flow don't play nice but creating
spring-devtools.propertiesundersrc/main/resources/META-INF/with the following line makes it works with no problem at allWhy I didn't this line as mentioned in the link:
Because I got this exception
So I have to include all jars for now. Hope this might help someone in the future, but please refer to Update #1 because this might going to be solved in the future Spring DevTools classloader limitations, but that lead to LiveReload server doesn't run.
Update #1
It seems this a DevTools issue (Customizing the restart classloader) which might be fixed soon Spring DevTools classloader limitations. It is started in this issue Spring Boot Dev Tools & Web Flow don't play nice
Original Answer
I had the same issue several times, I have done a test and I found that a weird behavior.
CustomFlowAction.java
(Flow Example 1) some-flow.xml
This example is using a spring bean, it works fine and someAction method returns true.
(Flow Example 2) some-flow.xml
This example is creating a new object from SomeModel and stores it flowScope, then uses it inside the template.
The output is:
Some guys guided me to there might be another classloader involved in the issue, and one told me this:
Hope this would be helpful for you and anyone else in trouble like me :)