Results 1 to 2 of 2

Thread: For injection, setter and constructor should be public ?

  1. #1
    Join Date
    Jun 2008
    Posts
    1

    Default For injection, setter and constructor should be public ?

    Simple question

    Should setter or constructor be public for dependency injection ?

    It seems to be doubtless, but is not explicitly stated anywhere in reference manual.
    Why don't you clarify that in reference manual.
    Last edited by 3rdstage; Jun 12th, 2008 at 03:44 AM.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Constructors can be anything, spring uses reflection for that so you could go with private constructors. The setters have to be public, we use the normal Property stuff which ships with the JDK.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •