在 weblogic 10.3.6 上访问 spring boot 的 application.properties [英] Accesing spring boot's application.properties on weblogic 10.3.6

查看:52
本文介绍了在 weblogic 10.3.6 上访问 spring boot 的 application.properties的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过以下方式访问 application.properties 中定义的值:

I am trying to acces a value defined in application.properties in a following way:

@Value("${server.url}")
private String serverUrl;

它适用于嵌入式 tomcat,但是当我将其上传到 Weblogic 时出现以下错误:

It works on embedded tomcat, but when I upload it to Weblogic I get the following error:

创建名为authorizationServiceImpl"的 bean 时出错:注入自动装配依赖项失败;嵌套异常是java.lang.IllegalArgumentException:无法解析占位符'server.url' 值 "${server.url}";嵌套异常是java.lang.IllegalArgumentException:无法解析占位符'server.url' 值 "${server.url}"

Error creating bean with name 'authorizationServiceImpl': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'server.url' in value "${server.url}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'server.url' in value "${server.url}"

在 Weblogic 服务器上托管应用程序时如何使用 application.properties 文件?

How can I make use of the application.properties file when hosting app on Weblogic server?

推荐答案

我发现如果你想在 weblogic 10.3.6 上使用外部属性,你需要将文件放在所需的位置,并使用以下注解设置属性源在配置/启动类中:

I found that if you want to use external properties on weblogic 10.3.6 you need to put the file in desired location and use the follwing annotation for setting property source in configuration/startup class:

@PropertySource(value = { "file:/...domains/MYdomain/application.properties" })

这篇关于在 weblogic 10.3.6 上访问 spring boot 的 application.properties的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆