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
1
vote
1 answer

Set property value like part of another property in YAML config spring boot

I have YAMl config file with property: send-executor: thread-max-count: 5 And I have another property: ready-query: SELECT * From ...(another conditions).. where ROWNUM >= 5 Can I set instead 5 in ROWNUM >= 5 my another property…
ip696
  • 6,574
  • 12
  • 65
  • 128
1
vote
1 answer

How to dynamically generate a configuration property in spring configuration server?

I want my spring configuration server to return a property that is based upon client specific details. Specifically, in some profiles, I want the value of a property named 'self.url' to include the client's ip. In other profiles it's a constant…
idow09
  • 504
  • 1
  • 5
  • 15
1
vote
0 answers

spring boot config - property file order

I am using spring boot config. My configurations are located in one folder in git. The folder structure is as follows application.yml registry.yml I have the following property defined in application.yml registry: server: …
Saurabh Kumar
  • 16,353
  • 49
  • 133
  • 212
1
vote
1 answer

spring cloud config client set config url at property file

I have a spring cloud project. There are config server (config-srv), eureka server (eureka-srv) and some other service with business logic, let's call it main service (main-srv). I'm packaging them into jars and run one by one. My apps get their…
1
vote
0 answers

multiple InternalResourceViewResolver for jsp and html located in different folders

i hv an application which always return jsp file as a view from spring controller. shown below : @RequestMapping("/home") public class HomeController { @RequestMapping(value = "", method = RequestMethod.GET) public ModelAndView…
avi
  • 175
  • 2
  • 5
  • 17
1
vote
0 answers

Spring Boot 2.0.2 to 2.0.3.RELEASE Method servletEndpointRegistrar in ServletEndpointManagementContextConfiguration error

I'm trying to upgrade my Spring Boot 2.0.2 application to 2.0.3.RELEASE and faced the following issue during the application startup: *************************** APPLICATION FAILED TO START *************************** Description: Method…
alexanoid
  • 24,051
  • 54
  • 210
  • 410
1
vote
0 answers

WebApplicationInitializer with Spring Profiles and Annotation based Config

When we recently deployed a second spring application to the same Tomcat we ran into problems with unexpected interaction. As so often happens this opened a very large can of worms concerning how I have been creating my spring context. This is NOT…
Terry
  • 911
  • 10
  • 26
1
vote
1 answer

Spring 5.0.5 @Value doesn't resolve to correct type

I'm getting the following error in spring 5, and have read all of the posts regarding this issue with no luck. I just refactored the app to use the @Configuration via the PropertiesConfig class instead of appliationContext.xml for the property…
TheJeff
  • 3,665
  • 34
  • 52
1
vote
0 answers

Correct use of programmatic WebApplicationInitializer

AnnotationConfigWebApplicationContext the following when calling refresh() as is suggested in the javadoc NoSuchBeanDefinitionException: No qualifying bean of type 'x' Javadoc for: AnnotationConfigWebApplicationContext#register Note that…
Johan Sjöberg
  • 47,929
  • 21
  • 130
  • 148
1
vote
0 answers

Spring java config: register multiple spring beans by one java method

I'm trying to migrate project to Spring Boot. Previously Guice was used as DI. We have such guice module public class RepositoryImplementationModule extends AbstractModule { @Override protected void configure() { new…
NikolayS
  • 73
  • 1
  • 6
1
vote
3 answers

Is there a way to make some beans created by @Bean distinguishable?

This is an exotic use-case, so it requires some patience to understand and may require exotic solutions. The Context I'm making a library to be used with Spring that performs automatic actions upon specific bean instances present in the context,…
kaqqao
  • 12,984
  • 10
  • 64
  • 118
1
vote
1 answer

How allow base auto configuration class? When I have two that extend it, only the first one gets called

I have a base auto configuration class that uses generics to create the bean you want. But when I test having two configs that both extend that base config class, the second one never creates its beans. I believe this is because the method name is…
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
1
vote
2 answers

How would I do a Configuration class with a generics-typed bean? (Example included)

I want to provide a base configuration class that will handle creating beans with a generic type that gets defined when you extend the class as seen below. But it never calls the @Bean methods. import org.junit.Test; import…
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
1
vote
1 answer

Primitive type dependency injection in spring boot

Can you please provide me with an example of primitive type dependency injection in spring boot. I have tried once but TestConfiguration which is my custom bean definition class does not detect or does not recognize by spring boot application. here…
1
vote
3 answers

Spring Controller double validation for @ModelAttribute object

I have implemented controller with method: public Page search(@ModelAttribute @Valid EventsCriteria criteria){...} It works. EventsCriteria did not have special separate validator for itself, because it has inner annotation checkers like…
Sergii
  • 7,044
  • 14
  • 58
  • 116