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
2
votes
3 answers

Override bean definition doesn't work as expected

I'm confused by Spring's annotation based configuration. I have an interface MyInterface and two classes (MyClass1 and MyClass2) which implement this interface. @Component("MyInterface") public class MyClass1 implements MyInterface { public…
Oliver
  • 353
  • 1
  • 4
  • 16
2
votes
1 answer

Adding Bcrypt Encoding to Spring MVC Security with limit login attempts

I have a working project with limit login attempts i just need to add Bcrypt password encryptation. I have the following beans:
Kunal
  • 327
  • 1
  • 4
  • 19
2
votes
0 answers

How can I set a variable in a Spring bean configuration file?

I'm initialising my spring beans in my spring XML.
dwjohnston
  • 11,163
  • 32
  • 99
  • 194
2
votes
2 answers

How to create Spring Security 3.1 Datasource bean in a java class

I am new to JSF and Spring Security. I am building a JSF 2 project based on this tutorial. I want to put the dataSource bean in a java class because I am generating the url for the JDBC connection and users in another class. How to put this code…
hamza_tn
  • 37
  • 2
  • 9
2
votes
2 answers

Grails create a service from a factory

I would like to utilize a service written in Java in my Grails app using dependency injection. Creating it in Java without injection would look like this: ServiceFactory.newInstance().getElementService() I would like to use this in the same way…
John Mercier
  • 1,637
  • 3
  • 20
  • 44
2
votes
2 answers

How to make a UserDetailsManager available as a bean

I'm experimenting with spring-security for authentication and want to be able to add users at runtime. I figured using UserDetailsManager would be minimally intrusive. How do I make it available as a bean, so that I can access it in controllers and…
Silly Freak
  • 4,061
  • 1
  • 36
  • 58
2
votes
0 answers

Spring get FactoryBean property

In Spring, you can get a reference to a FactoryBean using the following syntax: This is necessary because if you reference the FactoryBean without the & you will simply get an instance of a bean that the…
kerl
  • 270
  • 1
  • 3
  • 17
2
votes
0 answers

How to conditionally create a bean using Spring?

I have this pattern: public class Factory { public GenericBean get(ContextEnum context, OneTypeArgs args) { switch (context) { case OneContext: Action a = new OneAction(args); return new GenericBean(a); …
airdump
  • 643
  • 1
  • 7
  • 15
2
votes
1 answer

How to add internationalization to Spring MVC

I am trying to use add Internationalization to my Spring based project. I tried a lot of guides but I can't make it work. I am stuck at this for a long time and I can't find whats wrong.So to start, my mvc-dispatcher-servlet.xml looks like…
user2271933
  • 491
  • 2
  • 10
  • 25
2
votes
0 answers

Spring security protect pointcut using bean profiles duplicate definition

When using Spring security, I'd like to define different acceptable roles for a method per profile being ran. The problem I'm having is the protect-pointcut definition does not appear to accept context placeholders (doesn't translate if using…
2
votes
1 answer

Autowire a single argument in a constructor

In a constructor with 2 arguments, I want to explicitly wire one and autowire the other. Something like: public Obj(Interface arg, Interface arg2) { // stuff } And in the bean definition:
Simeon
  • 7,582
  • 15
  • 64
  • 101
2
votes
0 answers

Injecting a bean in a Security Filter (Spring)

Before the login, I added a filter that checks if a the computer name is registered in the database. For this, I inject a repository in the filter. The problem is that it marks the bean as null, and I read the filter and the bean are in different…
2
votes
1 answer

Changing the value of an attribute with xslt

There are a number of other questions that deal with this area, but I can't make the solutions there work I have a transform that splits up a Spring bean file containing multiple beans into a set of files, each with one bean
The Archetypal Paul
  • 41,321
  • 20
  • 104
  • 134
2
votes
1 answer

spring xsd:element name to bean class mapping

In spring integration and other spring derivatives, xml elements(tags) are used to simplify spring configuration files by defining element to bean class mapping. I am interested to know where the mapping between the xsd:element and bean class is…
nabsha
  • 168
  • 1
  • 10
2
votes
1 answer

Generate bean definition of multiple classes automatically

How can I create bean definition of multiple classes in spring? I know the spring TS helps to create bean definition but can it used to create for multiple classes at one time?
Chotka
  • 1,278
  • 2
  • 8
  • 8