I have this Spring Data repository. Custom methods are auto-implemented by Spring Data (using reflection, proxies or whatever)
public interface UserRepository extends CrudRepository<User, String> {
//custom methods
}
Somewhere, I have this:
@Autowired
UserRepository userRepository;
Now, I'm getting rid of Spring context and stop using Spring based dependency injection. I'm wonder if it's possible to create an instance of UserRepository
without initialize the Spring context. Like this:
UserRepository userRepository = new UserRepository();
Obviously, that does not work. But I'm looking for something similar. According this answer, it's not possible to see the repository's generated code because Spring uses proxies runtime.
Is there a way to achieve what I want?