Is there a Java framework available that can automatically generate JavaScript code to access backend beans? For instance, suppose I have a Spring service named TestService
:
public interface TestService {
public static class UserDTO {
public String username;
public Date birthday;
}
public List<UserDTO> findAllUsersByUsername(String username);
}
I would like to be able to call this service from JavaScript in the following manner:
console.print(testService.('test')[0].username);
, without having to create any controllers or handle ajax/xhr requests. Ideally, I would be able to simply run an ant/maven task and include a generated JavaScript file in my HTML page.
Does anyone know if such a framework already exists?
Thank you in advance.