• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

@Bean scope and autowire properties

 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
As we know by default the scope of a bean is singleton .

Lets say :



This is a bean B that spring will create and give it a name is bb .It scope is singleton .
But how could I change it's scope to prototype .

I was trying to give like :



but compiler showing error .
I have got this info from : webpage

Can some one explain this :



I know what actually the autowring is and how it works .But in the mentioned code snippet how it works

Thanks ,
Satya
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the compiler error?
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Am getting : The attribute scope is undefined for the annotation type Bean .
Am using spring version 3.0.5 .
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using documentation from an old version of spring. The documentation that you are using is 6 years old.

In 3.0+, you should Scope annotation.
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
o yes , thanks Jayesh got my answer !!!

One quick question as this is related to this post :

I have observed we can create simple object / jdk proxy / cglib proxy by using i.e the proxyMode property of the @Scope . I know what proxy is (jdk / cglig).

My question ,,, what are few benefits for which I go for jdk proxy / cglib proxy , rather simple object ?

I came to know the cglig proxy works lazily ,,, ok that is a good feature ....but what about jdkDynamicAop proxy ?

Let me know if you have any further query on this ..

Satya
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic