Using injected proxies for asynchronous tasks
When using tasks, you could also create your own executor. If you have very specific needs, it could be really handy.
This recipe will show you how to create a proxy executor that can be injected and used in the whole context of your application.
Getting ready
Let's first add our Java EE 8 dependency:
<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>8.0</version> <scope>provided</scope> </dependency>
How to do it...
- First, we create a
User
POJO:
public class User implements Serializable{ private Long id; private String name; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public User(Long...