我使用spring boot和jboss eap 6.4来部署应用程序。在我的pom.xml设置配置服务器中。文件名是letter-printing-eap-generator.yml。该文件包含值。如何从该文件中获取数据?还是可以给我参考?因为我找到了,但没有人与我的案子相匹配。
pom.xml:
<properties>
<config.server>http://10.170.49.103/configserver</config.server>
</properties>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.9.Final</version>
<configuration>
<jbossHome>${jboss.home}</jbossHome>
<serverArgs>
<serverArg>-Dspring.profiles.active=${run.profiles}</serverArg>
<serverArg>-Dspring.cloud.config.uri=${config.server}</serverArg>
</serverArgs>
</configuration>
</plugin>
application.properties:
spring.application.name=letter-printing-eap-generator
bootstrap.yml:
spring.jmx.default-domain: letter-printing-eap-generator
最佳答案
@Service
public class SomeServiceServiceImpl implements SomeService{
@Value("${letter-printing-eap-generator}")
private String letterPrintingEapGenerator;
//methods
}