MentaContainer

Rev

Rev 91 | Rev 98 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 91 Rev 94
Line 93... Line 93...
93
                                                                                           // or the hibernate SessionFactory
93
                                                                                           // or the hibernate SessionFactory
94
               
94
               
95
                // "conn" = the name of the property
95
                // "conn" = the name of the property
96
                // Connection.class = the type of the property
96
                // Connection.class = the type of the property
97
                // "connection" = the source from where the dependency will come from
97
                // "connection" = the source from where the dependency will come from
98
                c.wire("conn", Connection.class, "connection");        
-
 
-
 
98
                c.autowireBySetter("conn", "connection");              
99
               
99
               
100
                UserDAO userDAO = c.get("userDAO");
100
                UserDAO userDAO = c.get("userDAO");
101
               
101
               
102
                // the container detects that userDAO has a dependency: name = "conn" and type = "Connection.class"
102
                // the container detects that userDAO has a dependency: name = "conn" and type = "Connection.class"
103
                // where does it go to get the dependency to insert?
103
                // where does it go to get the dependency to insert?
Line 125... Line 125...
125
               
125
               
126
                c.ioc("userDAO", JdbcUserDAO.class);
126
                c.ioc("userDAO", JdbcUserDAO.class);
127
               
127
               
128
                c.ioc("connection", Connection.class);
128
                c.ioc("connection", Connection.class);
129
               
129
               
130
                c.wire("conn", Connection.class, "connection");
-
 
-
 
130
                c.autowireBySetter("conn", "connection");
131
               
131
               
132
                SomeService service = new SomeService();
132
                SomeService service = new SomeService();
133
               
133
               
134
                c.populate(service); // populate (inject) all properties of SomeService with
134
                c.populate(service); // populate (inject) all properties of SomeService with
135
                                                         // beans from the container
135
                                                         // beans from the container