Migrating Spring-based Application Configuration to Alibaba Cloud ACM

What Configuration Items Are Required to Be Migrated to ACM?

Timeliness: Comparison between Static and Dynamic Configuration Items

Security: Comparison between Non-Sensitive and Sensitive Configuration Items

How Can I Migrate Spring-based Java Application Configuration?

The Original Pure Static File Scenario

@Configuration
@ComponentScan("com.alibaba")
@PropertySource("classpath:myApp.properties")
public class AppConfig {
@Value(value="${url}")
private String URL;
@Value(value="${dbuser}")
private String USER;
@Value(value="${driver}")
private String DRIVER;
@Value(value="${dbpassword}")
private String PASSWORD;
@Value(value="${appVersion}")
private String version;
}

The Mixed Configuration Scenario after the Start of the Configuration Migration

<dependency> 
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-spring-context</artifactId>
<version>0.2.1- RC1</version>
</dependency>
@Configuration @ComponentScan("com.journaldev") 
@PropertySource("classpath:myApp.properties")
@EnableNacosConfig(globalProperties =
@NacosProperties(endpoint = "acm.aliyun.com", namespace = "xxx", accessKey = "xxx", secretKey = "xxx"))
@NacosPropertySource(dataId = "myApp.dbconfig.properties", autoRefreshed = true) public class AppConfig {
@Value(value="${url}") private String URL;
@Value(value="${dbuser}") private String USER;
@Value(value="${driver}") private String DRIVER;
@Value(value="${dbpassword}") private String PASSWORD;
@Value(value="${appVersion}")
private String version; public String getVersion() {
return version;
}
}

More Information

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store