Guice依赖注入(Scope)
本教程主要详细讲解Guice依赖注入中的一些高级选项,他们分别是 Scope , Eagerly Loading Bindings , Stage , Optional Injection 。我们将一一对他们进行讲解。 基础环境 技术 版本 Java 1.8+ Guice 4.2.3 初始化项目 初始化项目 mvn archetype:generate -DgroupId=com.edurt.sli.guice -DartifactId=guice-binder-scope -DarchetypeArtifactId=maven-archetype-quickstart -Dversion=1.0.0 -DinteractiveMode= false 修改pom.xml增加Guice依赖 <?xml version="1.0" encoding="UTF-8"?> < project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >