Git 構成があり、Spring サーバーはその構成を指しています。次に、以下の構成でクライアントを作成し、Properties オブジェクトにプロパティが入力されることを期待していました。何らかの理由で、Spring クラウド構成では機能しません..しかし、application.yml または application.properties では機能します。バーが適切に設定されているのがわかりますが、プロパティは表示されません。
何か案が?
@SpringBootApplication
@EnableAutoConfiguration
@RestController
@RefreshScope
@ComponentScan
@EnableConfigurationProperties
@ConfigurationProperties(prefix="datasource.mysql.jpa")
public class ConfigClientApplication {
private Properties properties;
public Properties getProperties() {
return properties;
}
@Value("${datasource.mysql.jpa.hibernate.dialect:sss}")
private String bar;
@RequestMapping("/")
public String home() {
String a ="";
try {
a = (String)properties.get("datasource.mysql.jpa.hibernate.dialect");
}catch (Exception e){
a = e.getMessage();
}
return "Hello "+bar + a;
}