草庐IT

property-injection

全部标签

java - 业务层 Jersey 的基本依赖注入(inject)

我正在从事一个使用RESTful服务的项目。我有web层、业务层等模块。我添加了基本的api层(使用Jersey)并且我得到了获取请求的基本响应。现在我必须将它连接到业务层。我在谷歌上搜索,但我不确定如何为我的项目实现每个解决方案。这是我的旅行资源类:@Path("trip")publicclassTripResource{@ContextprivateUriInfocontext;@InjectprivateAdminServiceadminService;publicTripResource(){}@GET@Produces("text/plain")publicListgetTe

java - 带有自定义注释的 Guice 动态注入(inject)

我有一些资源,但我不能迭代它并绑定(bind)它们,我必须使用key来请求资源。所以,我必须动态注入(inject)。我定义了一个注解@Target({METHOD,CONSTRUCTOR,FIELD})@Retention(RUNTIME)@Documented@BindingAnnotationpublic@interfaceRes{Stringvalue();//thekeyoftheresource}这样使用publicclassTest{@Inject@Res("author.name")Stringname;@Inject@Res("author.age")intage;@

java - 无法加载“类路径资源 [org/springframework/ws/client/core/WebServiceTemplate.properties]

我编写了一些代码,其中我正在使用另一个网络服务并使用WebServiceTemplate向该网络服务发送请求。但是当该代码触发时,我得到以下异常。我已经检查了SpringCore的库,一切似乎都正常,但不知道为什么这个服务会抛出这样的异常。应用程序上下文:服务:publicclassManageContactServiceextendsWebServiceGatewaySupport{privateWebServiceTemplatemanageContactsWSTemplate;publicWebServiceTemplategetManageContactsWSTemplate(

java - JSF2 : inject service objects to managedbean from Spring?

我已经对此进行了测试,试图将一个服务对象注入(inject)到@ManagedBean,但由于nullpointerexception而失败,因为userService为null。我目前使用的是Tomcat7、JSF2,这是我的一些pom.xml1.63.0.3.RELEASE3.6.0.Final....这是异常跟踪:javax.faces.el.EvaluationException:java.lang.NullPointerExceptionatjavax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Me

java - 将 Spring bean 注入(inject) RestEasy

是否可以将Springbean注入(inject)到RestEasy@Path类中?我设法用Jersey做到了,带有@InjectParam注释,但由于其他一些原因,我需要切换到RestEasy,而且我似乎找不到办法做到这一点(试过很好的ol'javax.inject.Inject,但什么都没有)。编辑此解决方案有效:http://www.mkyong.com/webservices/jax-rs/resteasy-spring-integration-example/但这不是注入(inject)..我还是更喜欢一些更优雅的东西。 最佳答案

报错:networks.app.ipam.config value Additional properties are not allowed (‘gateway‘

docker-compose启容器报错:networks.app.ipam.configvalueAdditionalpropertiesarenotallowed(‘gateway’wasunexpected)[root@localhost]#docker-composeup-dERROR:TheComposefile'./docker-compose.yml'isinvalidbecause:networks.app.ipam.configvalueAdditionalpropertiesarenotallowed('gateway'wasunexpected)原因:docker-comp

java - 如何在 yml 中获取我的配置值 - 使用 dropwizard(微服务)Jersey D.I @Injection?

这是我的代码片段。这是我的yml文件:productionServer:host:production-server.amazonaws.compublicIp:xx.xx.xx.xxprivateIp:xx.xx.xx.xxuserName:xx.xx.xx.xxpassword:xx.xx.xx.xxremoteFilePath:fake/path/fileName:test.txtprivateKey:private-public-key.ppkserver:applicationConnectors:-type:httpport:8080-type:httpsport:8443

java - 我无法设置我的 jndi.properties 来访问 Jboss 5 上的远程 EJB

我正在尝试设置Jboss服务器“客户端”(版本5.1.0)以使用来自另一个Jboss服务器(10.90.0.91)的远程EJB,但我无法使用Jboss客户端。我可以在我的客户端上使用这个简单的代码获取远程EJB:InitialContextctx=null;try{HashtablejndiProps=newHashtable();jndiProps.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");jndiProps.put(InitialContext.PROV

java - 错误注入(inject) : org. jboss.as.plugin.deployment.Deploy

我在构建我的maven项目时遇到以下错误。[INFO]---jboss-as-maven-plugin:7.9.Final:deploy(default-cli)@project-parent---[WARNING]Errorinjecting:org.jboss.as.plugin.deployment.Deployjava.lang.NoClassDefFoundError:org/jboss/as/controller/client/ModelControllerClientatjava.lang.Class.getDeclaredConstructors0(NativeMeth

java - 如何处理将依赖项注入(inject)富领域模型?

在具有丰富领域模型的Web服务器项目中(应用程序逻辑在模型中,而不是在服务中),您如何处理将依赖项注入(inject)模型对象?你有什么经验?您使用某种形式的AOP吗?像Springs@Configurable注解?加载时间还是构建时间weawing?您遇到的问题?您使用手动注入(inject)吗?那么您如何处理不同的实例化场景(通过库[如Hibernate]创建对象,使用“new”创建对象......)?或者您是否使用其他方式注入(inject)依赖项? 最佳答案 我们使用Spring的@Configurable(连同常规的new