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
0 answers

Autowiring with spring java config for beans in different packages not working

I am trying to implement a simple Spring AOP example. Use case: I have a compact disc (SgtPeppers) class with attributes such as artist, title. It has a method to play a specific track. I have created an aspect to count the number of times a track…
0
votes
1 answer

Halt spring boot application startup until spring cloud config server is up

I am trying to run my spring boot application with following properties set and I am expecting it to keep retrying to load properties from config server for 50 times with wait of 6 seconds between any two attempts and even after that it cannot…
0
votes
2 answers

Is there any way to pass an annotation's values to my config in Spring Boot?

I have a config and it's @Import-ed by an annotation. I want the values on the annotation to be accessible by the config. Is this possible? Config: @Configuration public class MyConfig { @Bean public CacheManager…
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
0
votes
5 answers

Execute Method on Spring start

i want to execute some code during (or rather at the end of) application startup. I found a couple of resources doing this using @PostConstruct annotation, @EventListener(ContextRefreshedEvent.class), implementing InitializingBean, implementing…
0
votes
0 answers

Relationship between contextConfigLocation(s) in web.xml

I have defined the contextConfigLocation(s) in web.xml as follows: contextConfigLocation /WEB-INF/spring/root-context.xml
lab bhattacharjee
  • 1,617
  • 2
  • 17
  • 33
0
votes
1 answer

Spring JarLauncher doesn't load application.yml from dependency

My problem is similar to one described here (I don't override classpath explicitly): Spring application.yml not detected when running with -classpath I have a SpringBoot application producing executable app.jar built with repackage goal. I have…
zeratul021
  • 2,644
  • 3
  • 32
  • 45
0
votes
1 answer

Integrating spring config server with "legacy" tomcat

I'm trying to deploy a spring boot application packaged as a war file to tomcat 8. I would also like to have the properties come from a config server. This config server can be a simple spring boot executable jar file, connected to git. I can't see…
odedia
  • 931
  • 2
  • 11
  • 27
0
votes
1 answer

Spring Boot: External configuration results in empty value

in my project I have a Spring Boot-based library that delivers me some commonly used services. In a Spring Boot project I make use of the library and do experience some problems while trying to retrieve some external configuration. The library…
Bugra
  • 189
  • 2
  • 14
0
votes
1 answer

Spring NoSuchBeanDefinitionException when wiring a @Component with value defined

My component is defined as below @Component("myBo") public class MyBO { @Autowired JpaRepository repository; Spring Data Interface: public interface MyDataRepository extends JpaRepository { Entitymanager…
patb23
  • 387
  • 5
  • 21
-1
votes
2 answers

Secondary type dependency injection does not work in spring boot

As per the documentation, spring boot will automatically check the bean class object created in any classes annotated with @Configuration & will override the default bean of that class & return the object with any properties that are injected as it…
-2
votes
2 answers

Static Method Depdendecy injection fails

I am trying to learn spring framework static method dependency injection, there are many questions posted already but my problem is different, in that I have taken one class package com.model; public class Test { private static String…
Vishal Kawade
  • 449
  • 6
  • 20
-2
votes
2 answers

Spring Configuration Server Cloud setup

I am using Spring Configuration server and currently my configurations are in git as per the documentations for configuration server. Now my problem is that my prod and stage env does not have access to git hence getting the properties from git…
Amol
  • 479
  • 5
  • 18
-3
votes
1 answer

NullPointerException while accessing an instance of Spring JdbcTemplate

I am trying to use Spring JDBCTemplate class to access database. As a first tutorial, I have used xml spring configuration file and everything works as expected. Now, I am trying to use @Configuration and created DataSource and JdbcTemplate…
Sara
  • 603
  • 8
  • 19
1 2 3
11
12