Questions tagged [spring-bean]

A simple JavaBean managed by the Spring IoC container.

A simple JavaBean managed by the Spring IoC container. These beans are created with the configuration metadata that is supplied to the container, for example, in the form of XML <bean/> definitions or @Bean annotation. Actually, the BeanFactory is the main IoC container which instantiates, configures, and manages these beans. These beans typically have associations with each other, and therefore have dependencies between themselves. These dependencies are configured in the configuration files used by the BeanFactory. Other dependencies that are invisible from the configuration file could be a function of programmatic interactions between beans at run-time.

767 questions
0
votes
2 answers

Spring unable to resolve bean

Spring 4 and Tomcat. Im trying to migrate a very simple spring-bootstrap project to a traditional spring webApp without spring boot. The problem is i cant get dependency injection work because aparently im not telling spring where/how to look up…
0
votes
1 answer

Spring security : Cannot resolve reference to bean while setting constructor argument

I am implementing Remember me in spring security.And here is my configuration
Sunil Kumar
  • 5,477
  • 4
  • 31
  • 38
0
votes
4 answers

Understanding Spring4 annotation beans

First time using Spring with annotions. I'm trying to define a singleton bean like: @Bean public ActionProducer actionProducer() { return new ActionProducer(); } But i feel like this is not a correct way to do since returns a "new" bean each…
Emre
  • 46
  • 5
0
votes
2 answers

Exception in initializing ApplicationContext HibernateException: Error applying BeanValidation relational constraints

I have created earlier Question where i have shave problem it can be temporarily by: Adding : hibernate.properties : javax.persistence.validation.mode=none I am not able to understand exact reason why it coming this temporarily I am able to fix with…
Gautam
  • 3,707
  • 5
  • 36
  • 57
0
votes
1 answer

Cannot find class [main.java.OutputHelper] for bean with name 'OutputHelper' defined in class path resource

I am new to Spring. I am creating simple project in which I just call generateOutout() method using beans. IOutputGenerator Interface: package mian.java; public interface IOutputGenerator { public void…
0
votes
1 answer

AOP doesn't work when class implements interface

I'm new with aspects and this is my second question about it. I have an Aspect running over 3 classes: A which is abstract and B and C which both inherit from A. Now, when I have A implementing the interface Testable, Spring doesn't load my…
Fernando
  • 751
  • 2
  • 13
  • 27
0
votes
2 answers

Spring: Static bean declared inside another bean does not get initialized on Java Config

I have a simple Spring boot application with following classes: Class A, it has the Class B declared as a bean with a static method: public class ClassA { private String something; public ClassA(String something) { this.something =…
Utku Özdemir
  • 7,390
  • 2
  • 52
  • 49
0
votes
1 answer

Spring security Autowired field with AutowiredMethod

I have SecurityConfig class like this (I'm not showing whole class, because stackoverflow not enabling me to do that - too much code): @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { …
Greg Zuber
  • 1,229
  • 1
  • 12
  • 22
0
votes
2 answers

Java Virtual Machine Launcher : A JNI Error with Spring

I use Windows10 Pro 32bit ENG, EclipseEE Mars, Java 8_66. If I want create a easy bean project with Spring and run it it show me a error in Windows dialog. When I enter this dialog it generated exception. Java Virtual Machine Launcher - Error : A…
0
votes
2 answers

Get more detailed Spring Bean Initialization Exceptions

I am getting some Exception like this when starting Tomcat: java.lang.NoClassDefFoundError: com/mycompany/mypackage/SomeClass at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at…
Martin
  • 3,018
  • 1
  • 26
  • 45
0
votes
0 answers

Getting exception with Spring NamespaceHandler for Spring Tx

I have facing some exception in My Spring project .. org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:data/data.xml] Offending resource:…
Charnjeet Singh
  • 3,056
  • 6
  • 35
  • 65
0
votes
2 answers

Manual bean registration and configuration order

I had an issue with spring's @Order annotation, it seems i can't get it to work in my application. Hence I managed to create a test class that imitates the very same behaviour which @Order does not have any effect on my components. The following…
px5x2
  • 1,495
  • 2
  • 14
  • 29
0
votes
0 answers

Spring bean @Component is not getting initialized and injected while application starts up but later it gets injected

I have class as below: @Component public class ServerFacade { @Autowired private ApplicationContext applicationContext; private static RegisteredCacheService registeredCacheService; @PostConstruct public void init() { registeredCacheService= …
Diwakar
  • 1
  • 3
0
votes
1 answer

Problems when deploying Spring contexts

I'm having problems with Spring contexts when deploying an application we 5 teams are developing (I belong in one of this teams). All of us compile our own jar. When locally debugging, Spring loads the contexts with no problem. The issue arises…
Fernando
  • 751
  • 2
  • 13
  • 27
0
votes
1 answer

Grails springSecurityService in resources.groovy gives null current user

I'm using Grails 2.4.3 and in grails-app/conf/spring/resources.groovy, beans = { someBean(com.domain.SomeBeanImpl) { springSecurityService = ref('springSecurityService') } } But inside SomeBeanImpl class, class SomeBeanImpl { …
renz
  • 1,072
  • 3
  • 11
  • 21