| .. | .. |
|---|
| 1 | +/* |
|---|
| 2 | +* Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved. |
|---|
| 3 | +*/ |
|---|
| 1 | 4 | package net.curisit.securis.ioc; |
|---|
| 2 | 5 | |
|---|
| 3 | 6 | import net.curisit.securis.services.ApiResource; |
|---|
| .. | .. |
|---|
| 11 | 14 | |
|---|
| 12 | 15 | import com.google.inject.AbstractModule; |
|---|
| 13 | 16 | |
|---|
| 17 | +/** |
|---|
| 18 | +* RequestsModule |
|---|
| 19 | +* <p> |
|---|
| 20 | +* Guice module that binds JAX-RS resource classes so they can be |
|---|
| 21 | +* injected and discovered by the DI container. |
|---|
| 22 | +* <p> |
|---|
| 23 | +* Notes: |
|---|
| 24 | +* - Currently binds resources explicitly. TODO indicates a future |
|---|
| 25 | +* improvement to bind dynamically via reflection / classpath scanning. |
|---|
| 26 | +* |
|---|
| 27 | +* @author JRA |
|---|
| 28 | +* Last reviewed by JRA on Oct 7, 2025. |
|---|
| 29 | +*/ |
|---|
| 14 | 30 | public class RequestsModule extends AbstractModule { |
|---|
| 15 | 31 | |
|---|
| 32 | + /** |
|---|
| 33 | + * configure<p> |
|---|
| 34 | + * Register resource types in the injector. |
|---|
| 35 | + */ |
|---|
| 16 | 36 | @Override |
|---|
| 17 | 37 | protected void configure() { |
|---|
| 18 | 38 | // TODO Securis: Make the bind using reflection dynamically |
|---|
| 19 | | - |
|---|
| 20 | 39 | bind(BasicServices.class); |
|---|
| 21 | 40 | bind(UserResource.class); |
|---|
| 22 | | - |
|---|
| 23 | 41 | bind(ApplicationResource.class); |
|---|
| 24 | 42 | bind(LicenseTypeResource.class); |
|---|
| 25 | 43 | bind(OrganizationResource.class); |
|---|
| 26 | 44 | bind(ApiResource.class); |
|---|
| 27 | 45 | bind(LicenseResource.class); |
|---|
| 28 | 46 | bind(PackResource.class); |
|---|
| 29 | | - |
|---|
| 30 | 47 | } |
|---|
| 31 | 48 | |
|---|
| 49 | + // Example provider (kept commented for reference) |
|---|
| 32 | 50 | // @Provides |
|---|
| 33 | 51 | // @RequestScoped |
|---|
| 34 | 52 | // public User provideUser() { |
|---|
| 35 | | - // return ResteasyProviderFactory.getContextData(User.class); |
|---|
| 53 | + // return ResteasyProviderFactory.getContextData(User.class); |
|---|
| 36 | 54 | // } |
|---|
| 37 | | - |
|---|
| 38 | 55 | } |
|---|