Questions tagged [spring-config]

Refers to the org.springframework.context.annotation package of the Spring Framework that moves bean definition and Spring configuration out of XML file and into Java classes via annotations.

Questions referring to @Configuration and @Bean will be the primary source of questions for this tag.

Useful Links

178 questions
0
votes
1 answer

Spring config server set up IllegalStateException: You need to configure a uri for the git repository

I was trying to set up the Spring Config server. Even If I am giving a bitbucket url in the config server application's bootstrap.yml, I am still getting exceptions. Below is the sample from my bootstrap.yml (config-server) spring.application.name:…
0
votes
2 answers

Spring Qualifier name based on the spring profile in Spring MVC

In my Spring Config, I have defined three beans as following.
user3858442
  • 25
  • 1
  • 8
0
votes
1 answer

Invalid bean definition with name 'configServicePropertySource'

I have defined ConfigServicePropertySourceLocator bean like following @Primary @Bean public ConfigServicePropertySourceLocator configServicePropertySource( ConfigClientProperties configClientProperties) { …
Saurabh Kumar
  • 16,353
  • 49
  • 133
  • 212
0
votes
1 answer

Spring configuration nested object list not working

I'm trying to setup spring boot to configure my app using this file: templates.customTemplates[0].file=templates/loopwithpicturesandbasics.odt templates.customTemplates[0].name=Simple look with pictures and multiple…
Vinz243
  • 9,654
  • 10
  • 42
  • 86
0
votes
1 answer

Spring Config map of String to object

I'm trying to get a Map with {"host1": DatabaseConfigurationProperty("abcd", "mytable", "user")}, however my below code only generates an empty Map. application.yml: database: host1: hostname: abcd name: mytable username:…
onepiece
  • 3,279
  • 8
  • 44
  • 63
0
votes
1 answer

Why to use @PropertySource instead of PropertyPlaceholderConfigurer?

In Spring Javadoc: "existing configuration makes use of the "systemPropertiesMode" and/or "systemPropertiesModeName" properties. Users are encouraged to move away from using these settings, and rather configure property source search order…
Aakash Parashar
  • 386
  • 1
  • 2
  • 14
0
votes
1 answer

I don't know how to replace config.properties by test properties Spring / JUnit

The thing is that have a project that uses a configuration class to get all the config properties @Configuration @PropertySource("file:/external/path/config/config.properties") public class AppSettings { @Value("${SOME.PROPERTY}") …
ernstr
  • 11
  • 3
0
votes
0 answers

initialize properties after loading from database while starting web app Spring

Currently, my application loads a properties file which has different properties separated by commas as property=propertyA,propertyB,propertyC I have a code which loads properties file and assigns as application properties as: public class…
user123475
  • 1,065
  • 4
  • 17
  • 29
0
votes
1 answer

@ConfigurationPropertie not working Spring Boot

Here is my application.properies... extract.magoo=tony I am trying to read this in. @Component @ConfigurationProperties("extract") public class ApplicationProperties { ... String magoo; @Autowired private Environment env; …
More Than Five
  • 9,959
  • 21
  • 77
  • 127
0
votes
1 answer

How to load 2 Spring Context Configurations with property placeholders in single a test class

This is my directory layout: . ├── pom.xml └── src ├── main │   ├── java │   │   └── biz │   │   └── tugay │   │   ├── Bar.java │   │   └── Foo.java │   └── resources │   ├── bar.xml │   …
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
0
votes
2 answers

TestExecutionListener is not listening at all

I have custom TestExecutionListener: public class CustomExecutionListener extends AbstractTestExecutionListener { @Override public void beforeTestMethod(TestContext testContext) throws Exception { // some code ... } …
0
votes
1 answer

Spring configuration via code vs. configuration via annotations

I create Spring ApplicationContext via code like the following: public static AnnotationConfigWebApplicationContext startContext(String activeProfile, PropertySource propertySource, Class... configs) { …
0
votes
1 answer

Can autoconfiguration and active profiles be combined in spring boot?

My question is about spring boot autoconfiguration and if default propertyvalues can be set depending on which profile is active. Sometimes the same properties are added in alot of microservices. For example if we depend on a swagger client. Then…
Ole Bille
  • 469
  • 2
  • 14
0
votes
2 answers

org.springframework.cloud.task.launcher.TaskLauncherSink required a bean of type 'org.springframework.cloud.deployer.spi.task.TaskLauncher'

I am trying to run spring cloud task rabbitmq, but I am receiving errors as follows: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) )…
0
votes
1 answer

Spring @Configuration annotation @Autowired service is null

I am using Spring Configuration and Jersey Configuration. This is my spring configuration: @Component @Configuration @EnableScheduling @EnableAspectJAutoProxy @EnableTransactionManagement @ComponentScan(basePackages = { "my.packages" }) public…
Andrew
  • 13
  • 3