- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
如何在 spring 中刷新 @PropertySouce(propertyFile)。
例如:-属性文件中有一个参数:-
MY_APP_NAME=MY APPLICATION
我正在使用
@Autowired Enviornment env;
从属性文件中获取属性值。
之后,我想将属性从“我的应用程序”更改为“应用程序”。
MY_APP_NAME=APPLICATION
它需要重新启动应用程序,但我不想重新启动应用程序。我希望当我更改属性时,它会在几秒钟后反射(reflect)在应用程序中。
最佳答案
如果你的项目是springboot你可以使用actuator,你可以使用'http://localhost:port/refresh ' 刷新您的属性
关于java - Spring @PropertySource 刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51394419/
在Spring框架中@PropertySource注解是非常常用的一个注解,其主要作用是将外部化配置解析成key-value键值对"存入"Spring容器的Environment
我想使用 @PropertySource 注释设置动态属性源值。谁能告诉我如何实现这一目标?对于下面我动态传递属性文件名。 @Configuration @PropertySource("classp
为什么当我尝试从属性文件输出数据时,显示的数据是错误的? 在我的 ChatApp 项目中,我有 datasource-cfg.properties 文件: # DataSource ds.databa
我有一个@Configuration类。这个类有一个@PropertySource。 我希望每个应用程序都有一个不同的属性。 示例: @Configuration @PropertySource("f
我有一个完美的测试设置,如下所示...... @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(loader = Annota
自 4.0 以来, Spring 为所有标记为 @Configuration 的类引入了一个新的注解 @PropertySources。它采用不同的 @PropertySource 作为参数。 @Pr
我正在使用 Spring Java 配置来创建我的 bean。但是这个 bean 对 2 个应用程序是通用的。两者都有一个属性文件 abc.properties 但具有不同的类路径位置。当我把明确的类
在我的 sprint 启动应用程序中,我有一个配置类来读取属性文件:common.properties 和 dev.properties。我在两个属性文件中都有相同的 key server.url。该
我正在 Tomcat 中将 Spring Boot 应用程序部署为 WAR 文件。我希望我的 application-local.properties 能够覆盖 application.propert
我的配置文件有问题,它位于我的 jar 文件之外的其他目录中。 我使用 @PropertySource 加载属性。 @PropertySource(ignoreResourceNotFound = t
我只需要读取MyServiceImpl.java类中的menu.properties文件这些值不是特定于环境的。 menu.properties ---------------- menu.optio
我有一个 micronaut 项目,我想为私有(private)数据(如数据库连接等)提供一个非版本化的配置文件 此信息必须通过@Property注释加载,但由于将有多个.yml(至少还有一个appl
我有一个关于以编程方式向 Spring 上下文添加属性的问题。 GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(
我正在尝试通过以下方式创建一个 spring 配置类 @Configuration @PropertySource(value={"file:${my.dir}/fileone.properties"
嗨,我是 Spring 和 Jpa 集成的初学者。当我尝试配置我的数据库连接时,详细信息处理程序 itp。我发现了 Spring 的奇怪行为。 首先,我有3个配置文件: 1) RootConfig -
如何在 spring 中刷新 @PropertySouce(propertyFile)。 例如:-属性文件中有一个参数:- MY_APP_NAME=MY APPLICATION 我正在使用
我想用 java ... -Denv=prod ... 启动我的程序并且有 @PropertySource("classpath:/settings/$idontknowwhat$/database.
配置 @Configuration @PropertySources({ @PropertySource("classpath*:properties/test-database.proper
我遇到了连线问题,但没有找到任何提示。 我正在使用属性文件处理数据库分片配置。我得到了一个负责加载这些属性的类: @Component @PropertySources(value = *arrayO
无论如何我可以在我的程序中知道通过Spring的@PropertySource注释加载的文件的完整路径。我需要它显示在日志中,以便可以知道应用程序中正在使用哪个属性文件 最佳答案 此信息已由 Stan
我是一名优秀的程序员,十分优秀!