腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
Spring
org.springframework.core.env.Environment
或
@
Value
提供
null
spring
、
spring-mvc
、
properties
我正在尝试通过
org.springframework.core.env.Environment
在我的自动化项目中加载属性。但是我将Environment设置为
null
。以下是我的配置。pom中的依赖关系: <dependency> <artifactId>
spring
-core</dependency>
浏览 160
提问于2020-07-22
得票数 1
1
回答
如何从Application.properties中检索值?
spring-boot
.
spring
.mail.default-encoding=UTF-8 # Default MimeMessage encoding.
spring
.mail.port= # SMTP server port.some.prop = testingTesting 如何在java类中检索sp
浏览 1
提问于2016-11-02
得票数 1
回答已采纳
2
回答
在
spring
boot中无法读取环境属性
java
、
spring
、
spring-boot
、
environment-variables
import org.springframework.beans.factory.annotation.Autowired; import
org.springframework.core.env.Environment
问题是,如果我在tomcat上部署war文件,它会运行file,但如果我从eclipse运行与
spring
启动应用程序相同的应用程序,它不会读取环境属性,因此返回值为
null
。
浏览 0
提问于2017-03-30
得票数 0
1
回答
将@
Value
注释与
Spring
和SPeL结合使用
spring
我正试图在我的
spring
1.5应用程序中找到一种方法来执行以下操作。 如果需要更多细节请告
浏览 1
提问于2017-07-10
得票数 2
回答已采纳
3
回答
使用@PropertySource和外部JSON文件配置
Spring
属性
java
、
json
、
spring
、
spring-mvc
、
spring-boot
我使用的是
spring
boot,可以访问keycloak。classpath:keycloak.json")private Environment env; public String method(Model model) {} 问题是这个环境变量的值为
null
浏览 8
提问于2017-10-20
得票数 1
2
回答
按配置文件禁用/删除
spring
boot数据源
spring
、
spring-boot
、
spring-data-jpa
、
spring-config
使用
spring
boot yaml配置,我有一个如下所示的数据源: url: jdbc:postgresql://somehost/somedb*************************** Failed to auto-configure a DataSource: '
spring
.datasource.url
浏览 17
提问于2018-10-04
得票数 2
1
回答
将值设置/放入
Spring
-boot的
Spring
环境中,以供以后使用
java
、
spring
、
properties
、
spring-boot
、
spring-environment
是否有任何方法可以将一些值设置
或
放入
org.springframework.core.env.Environment
中 <groupId>org.springframework.boot</groupId> <version>1.3.1.REL
浏览 0
提问于2016-04-01
得票数 1
4
回答
访问自定义启动器中的
spring
应用程序名称
java
、
spring
、
spring-boot
我试图访问自定义初学者自动配置中的
spring
应用程序名称。@Configuration privateString appName;
spring
.factories asco.test.Custo
浏览 0
提问于2018-11-13
得票数 1
回答已采纳
3
回答
根据input - java
Spring
在运行时从属性文件中获取值
java
、
spring
、
properties-file
colour.roperties文件lily = white我需要获取颜色的值,如下所示@
Value
我如何在java
Spring
中做到这一点。我需要在运行时根据用户输入获取一个值(从属性文件中定义的50个值中)。如果我不能使用@
Value
,你能告诉我其他的处理方法吗?
浏览 5
提问于2014-02-07
得票数 9
2
回答
Spring
- @
Value
返回
null
java
、
spring
、
spring-mvc
我在/src/main/resources/下有一个属性文件,我希望使用
Spring
从它加载数据。classpath:UserUtil.properties" />在我的课堂上,我加载了如下内容: @
Value
浏览 0
提问于2017-06-14
得票数 2
回答已采纳
1
回答
如何以编程方式覆盖
spring
环境变量
spring
、
spring-boot
我在我的
spring
引导应用程序中使用了一个bootstrap.properties文件。是否可以通过代码覆盖bootstrap.properties中定义的属性值。
org.springframework.core.env.Environment
没有任何方法来设置属性。是否有方法在
spring
核心环境中添加新属性
或
重写现有属性。
浏览 0
提问于2019-08-16
得票数 2
回答已采纳
3
回答
弹簧不加载属性
spring
、
maven
、
intellij-idea
、
properties
目前,我正在学习使用
Spring
,但我已经不能仅仅添加一些属性了。@PropertySource("classpath:config.properties") public static void main(String[] args) {
浏览 0
提问于2017-10-04
得票数 0
1
回答
如何将
Spring
配置注入TestExecutionListener of JUnit5?
java
、
spring
、
spring-boot
、
junit
、
spring-test
我正在使用JUnit5 +
Spring
运行测试。import org.springframework.stereotype.Component; }这是不起作用的,对于env,我将得到
null
。 据我所知,这是因为JUnit负责加载这个侦听器,而不是<
浏览 10
提问于2022-07-26
得票数 0
1
回答
提供
"
null
value
“的输入
javascript
、
html
当我在JS文件中打印出txtDisplayname时,它显示为
null
。有人能帮上忙吗?我想要在按下Login
或
Sign up按钮时打印txtDisplayname,但它不是注册输入,而是给出一个空值firebase.auth().onAuthStateChanged(firebaseUser
浏览 0
提问于2021-06-25
得票数 0
1
回答
ContextRefreshedEvent在
Spring
集成测试中过早触发
java
、
spring
、
spring-boot
、
event-handling
、
spring-boot-test
private WebSocketServer server; // created too late } 是否有可能以某种方式抑制ContextRefreshedEvent
或
推迟应用程序上下文的创建
浏览 14
提问于2018-09-06
得票数 0
回答已采纳
1
回答
从application.properties读取动态变量
spring-boot
我正在从application.properties读取一个名为clients的属性,例如:但是,现在我还想读取其他属性,其中名称取决于clients属性的值,例如:marchentId.FI=12321321如何根据clients属性的值读取这些属性?
浏览 10
提问于2019-03-25
得票数 0
回答已采纳
1
回答
我可以从自动配置中排除特定的属性吗?
spring
、
spring-boot
我正在使用
spring
并尝试使用"PropertySourcesPlaceholderConfigurer“从文件系统加载外部属性文件,但是我得到了一个错误,如下所示:
Value
: BETA Reason: Failed to convert property
value
浏览 9
提问于2016-10-12
得票数 2
回答已采纳
2
回答
如何在
Spring
项目中将application.properties中的环境属性转换为logback.groovy?
spring
、
groovy
、
environment-variables
、
logback
、
spring-boot
尝试将application.properties/application.yml中定义的属性注入
Spring
项目中的logback.groovy脚本。我不能将Environment
或
ApplicationContext注入groovy脚本。src/main/resources/logback.groovy import
org.spr
浏览 4
提问于2014-09-12
得票数 9
6
回答
Spring
Boot - @
Value
返回
null
java
、
spring
、
spring-boot
我尝试使用@
Value
注解并从属性文件中自动填充我的变量,但没有成功。未设置值,并且值为空。taskService.javapublic class TaskService { String aa; } return
null
浏览 0
提问于2017-08-31
得票数 2
3
回答
@
Value
Spring
返回
null
[重复]
这个问题在这里已经有答案了: java -
Spring
@
Value
注释返回
null
(2个答案) 5天前就关门了。我正在尝试运行这段代码,但我不知道它为什么返回
null
请帮帮忙 application.properties content.upload-dir= hello 测试类别 package com.example.demo;
浏览 100
提问于2021-02-25
得票数 0
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
聊一聊 Spring 中的线程安全性
Spring 扩展之深入分析 Bean 的类型转换体系
和 if else说再见,SpringBoot 这样做参数校验才足够优雅!
【故障现场】重命名引起的线上问题
Spring Boot数据源属性注入与创建
热门
标签
更多标签
活动推荐
运营活动
广告
关闭
领券