|
From: jacksu <jac...@gm...> - 2007-06-22 13:15:36
|
Thanks all. I will go to On Jun 22, 3:20 am, "Joris Kuipers" <jor...@gm...> wrote: > No, this is caused by the fact that he's using a BeanFactory instead of an > ApplicationContext: only the latter will eagerly instantiate your singletons > at startup. > BTW, this list is not intented for user questions: for that, please use the > forum (http://forum.springframework.org/). > > Joris > > 2007/6/22, nicolas de loof <nic...@gm...>: > > > > > > > AFAIK since spring 2.0 bean creation became lazy, so this bean having no > > reference in the context will not be instanciated neither started. Simply > > addind lazy-loading="fasle" will solve this. > > > Hope it helps ! > > Nicolas > > > 2007/6/22, jacksu <jac...@gm...>: > > > > I think I must done something wrong, I am trying to hook JMX to > > > spring, but appears spring framework just ignore the JMX exporter > > > class totally, unless I call getBean of that exporter class > > > explicitly. > > > > Would anyone here could give me some hint? Thanks. > > > > public class Main { > > > public static void main(String args[]) throws Exception { > > > BeanFactory factory = > > > new XmlBeanFactory(new > > > ClassPathResource("com/jacktest/ > > > beans.xml")); > > > > // if uncomment the following line. I could see my testbean in > > > jconsole. but if without this line, jconsole couldn't > > > // find my testbean. > > > // factory.getBean("exporter"); > > > > TestBean tst = (TestBean)factory.getBean("testBean"); > > > } > > > } > > > > This is the bean definition: > > > <?xml version="1.0" encoding="UTF-8"?> > > > <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" > > > "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> > > > <beans> > > > > <bean id="testBean" class="com.jacktest.TestBean "> > > > <property name="firstName" value="Jack"/> > > > </bean> > > > > <bean id="mbeanServer" > > > class="org.springframework.jmx.support.MBeanServerFactoryBean" /> > > > > <!-- this bean must not be lazily initialized if the exporting is > > > to happen --> > > > <bean id="explorerBean" > > > class="org.springframework.jmx.export.MBeanExporter"> > > > <property name="beans"> > > > <map> > > > <entry key="bean:name=testBean" value-ref="testBean"/> > > > </map> > > > </property> > > > </bean> > > > </beans> > > > > And my command line has flag: -Dcom.sun.management.jmxremote. > > > > Thanks in advance. > > > > -- Jack > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by DB2 Express > > > Download DB2 Express C - the FREE version of DB2 express and take > > > control of your XML. No limits. Just data. Click to get it now. > > >http://sourceforge.net/powerbar/db2/ > > > _______________________________________________ > > > Springframework-developer mailing list > > > Spr...@li... > > >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > >http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now.http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > Springframework-developer mailing list > Spr...@li...://lists.sourceforge.net/lists/listinfo/springframework-developer- Hide quoted text - > > - Show quoted text - |