| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package com.google.inject.example; |
| 18 |
|
|
| 19 |
|
import com.google.inject.AbstractModule; |
| 20 |
|
import com.google.inject.CreationException; |
| 21 |
|
import com.google.inject.Guice; |
| 22 |
|
import com.google.inject.Injector; |
| 23 |
|
import static com.google.inject.example.JndiProvider.fromJndi; |
| 24 |
|
import javax.naming.Context; |
| 25 |
|
import javax.naming.InitialContext; |
| 26 |
|
import javax.sql.DataSource; |
| 27 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 28 |
|
class JndiProviderClient { |
| 29 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 30 |
0
|
public static void main(String[] args) throws CreationException {... |
| 31 |
0
|
Injector injector = Guice.createInjector(new AbstractModule() { |
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 32 |
0
|
protected void configure() {... |
| 33 |
|
|
| 34 |
0
|
bind(Context.class).to(InitialContext.class); |
| 35 |
|
|
| 36 |
|
|
| 37 |
0
|
bind(DataSource.class) |
| 38 |
|
.toProvider(fromJndi(DataSource.class, "...")); |
| 39 |
|
} |
| 40 |
|
}); |
| 41 |
|
} |
| 42 |
|
} |