@-Value funktioniert nicht im Frühjahr @ConfigurationJava

Java-Forum
Anonymous
 @-Value funktioniert nicht im Frühjahr @Configuration

Post by Anonymous »

Benötigen Sie Hilfe, wo ist das Problem?@Configuration
@PropertySource(value={"classpath:application.properties"})
class WebConfig extends WebMvcConfigurerAdapter{

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
< /code>

Ich habe eine andere Konfigurationsklasse, in der ich versuche, die Eigenschaften als < /p>

myServerconfig.java

zu verwenden@Configuration
class MyServerConfig {

@Value("${server.url}")
private String url;
...
}
< /code>

Application.properties

server.url=http://localhost:8080/test/abc
< /code>

Aber erhalten: < /p>


Java.lang.ILLEGALARGUMENTException: konnte den Platzhalter 'server nicht auflösen. Irgendwelche Gedanken?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post