java - Why Spring Integration management configuration doesn't work by default? -
i investigating new spring integration benefit - integration management configuration, in basis of java docs 1 provided 4.2 release.
i've written simple java based context.
/** * @author eugene stepanenkov */ @configuration @enableintegration @enableintegrationmanagement @integrationcomponentscan(basepackages = { "com.stepsoft.study.flow", "com.stepsoft.study.configuration.flow", "com.stepsoft.study.flow.messaging" }) @componentscan(basepackages = { "com.stepsoft.study.flow", "com.stepsoft.study.configuration.flow", "com.stepsoft.study.flow.messaging" }) @import({ datacontext.class, importflowcontext.class }) @propertysource("classpath:flow.properties") public class flowcontext { @value("${flow.defaultpoller.fixeddelay}") private int fixeddelay; @value("${flow.defaultpoller.maxmessagesperpoll}") private int maxmessagesperpoll; @bean(name = default_poller) public pollermetadata defaultpoller() { pollermetadata pollermetadata = new pollermetadata(); pollermetadata.settrigger(new periodictrigger(fixeddelay, milliseconds)); pollermetadata.setmaxmessagesperpoll(maxmessagesperpoll); return pollermetadata; } }
when initialization of context performed illegalargumentexception enabledcountspatterns must not empty
.
i've found place in sources
/** * set array of simple patterns component names message counts * enabled (defaults '*'). * enables message counting (`sendcount`, `errorcount`, `receivecount`) * components support counters (channels, message handlers, etc). * initial setting only, individual components can have counts * enabled/disabled @ runtime. may overridden entry in * {@link #setenabledstatspatterns(string[]) enabledstatspatterns} additional * functionality on simple counts. if pattern starts `!`, counts disabled * matches. components match multiple patterns, first pattern wins. * disabling counts @ runtime disables stats. * @param enabledcountspatterns patterns. */ public void setenabledcountspatterns(string[] enabledcountspatterns) { assert.notempty(enabledcountspatterns, "enabledcountspatterns must not empty"); this.enabledcountspatterns = arrays.copyof(enabledcountspatterns, enabledcountspatterns.length); }
as far understand property got annotation enableintegrationmanagement
/** * list of simple patterns component names message counts * enabled (defaults '*'). enables message * counting (`sendcount`, `errorcount`, `receivecount`) components * support counters (channels, message handlers, etc). initial setting * only, individual components can have counts enabled/disabled @ runtime. may * overridden entry in {@link #statsenabled() statsenabled} additional * functionality on simple counts. if pattern starts `!`, counts disabled * matches. components match multiple patterns, first pattern wins. * disabling counts @ runtime disables stats. * defaults no components, unless jmx enabled in case, defaults * components. overrides {@link #defaultcountsenabled()} matching bean names. * @return patterns. */ string[] countsenabled() default "";
but @ same time:
/** * default setting enabling counts when bean name not matched * {@link #countsenabled() countsenabled}. * @return value; false default, or true when jmx enabled. */ string defaultcountsenabled() default "false";
so have 2 misunderstandings:
- why in java docs written -
(defaults '*')
, default value''
presented in annotation? - why there no logic check if
defaultcountsenabled
true checkcountsenabled
property?
p.s. don't need provide default value myself using custom annotation or setting properties in existing one. more: in basis of sources same think related property defaultstatsenabled
in couple statsenabled
. in java docs related metricsfactory
described the defaultmetricsfactory used if omitted
seems error , nosuchbeandefinitionexception
.
this known bug.
it fixed on master (4.2.1.build-snapshot in repo.spring.io/snapshots repo); fixed in 4.2.1.release plan release next week.
we failed add test default annotation (no attributes); otherwise we'd have discovered earlier.
Comments
Post a Comment