我想以某种方式注入HttpMessageConverterSpring-MVC中注册的所有实例.我可以成功注入所有已注册的内容.
private HttpMessageConverter[] converters;
@Autowired
public void setConverters(HttpMessageConverter[] converters) {
this.converters = converters;
}
Run Code Online (Sandbox Code Playgroud)
但是,如果转换器在上下文中注册(即,如果在外部定义<annotation-driven>),则仅注入.
我确实想过我会尝试<beans:ref在里面使用<annotation-driven><message-converters>但是在spring-web 3.1中不支持它.
是否有一些我可以注入的类可能有一个我可以用来获得转换器的属性?理想情况下,我希望看到他们注册的过滤器链中的顺序.
作为一个例子,如果我有一个元素,其大小我希望是另一个元素的两倍大小,我将如何实现这一目标?
一个例子如下,mirroredObject是我想要使用它的一半宽度作为Border对象宽度的对象.
<Border Width="{Binding ActualWidth, ElementName=mirroredObject, Mode=Default}" />
Run Code Online (Sandbox Code Playgroud)
我有其他情况,我可能想要绑定的属性可能是其他元素的宽度的总和,我将如何实现这一点?
解
请参阅我的答案,以获得lenanovd答案帮助的解决方案.
我希望将jQuery图标添加到另一个由另一个插件(jquery.tablesorter.js)添加ui-icon-triangle-1-n的.headerSortUp类中,特别是我希望将该图标添加到该类中tablesorter.
我正在尝试添加以下类但不能为我的生活如何为它制定一个精灵.
table.sortable thead tr .headerSortUp {
cursor: pointer;
background-position: center right;
background-repeat: no-repeat;
background-size: 16px 16px;
background: url(jquery-ui/css/smoothness/images/ui-icons_222222_256x240.png) 0 -16px;
}
Run Code Online (Sandbox Code Playgroud)
我之前没有使用CSS精灵,所以我不完全确定如何做到这一点.
我看到的情况是我只想要显示背景图像的一部分,但我希望它位于文本的右侧中心并且不重复.
在XML配置中,我可以创建以下内容:
<security:http pattern="/api/**"
create-session="never"
use-expressions="true">
<security:http-basic entry-point-ref="xBasicAuthenticationEntryPoint"/>
<security:session-management />
<security:intercept-url pattern="/tests/**" access="isAuthenticated()"/>
<security:intercept-url pattern="/api/**" access="isAuthenticated()"/>
</security:http>
<security:http auto-config="true" use-expressions="true" realm="ACME">
<security:intercept-url pattern="/favicon.ico" access="permitAll" />
<security:intercept-url pattern="/static/**" access="permitAll"/>
<security:intercept-url pattern="/error/**" access="permitAll" />
<security:intercept-url pattern="/" access="permitAll"/>
<security:intercept-url pattern="/login" access="permitAll"/>
<security:intercept-url pattern="/logout" access="isAuthenticated()"/>
<security:form-login login-page='/login'
authentication-failure-url="/login?error"/>
<security:logout logout-url="/logout" logout-success-url="/"/>
</security:http>
Run Code Online (Sandbox Code Playgroud)
/api/**如果没有会话,这将允许所有呼叫不尝试验证用户.
如何使用基于Java的配置创建相同的配置?
我的WebSecurityConfigurerAdapter#configure(HttpSecurity)方法如下:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.addFilter(switchUserFilter())
.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/static/**").permitAll()
.anyRequest().authenticated()
.and().formLogin()
.loginPage("/login")
.permitAll()
.defaultSuccessUrl("/")
.and().logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/");
}
Run Code Online (Sandbox Code Playgroud) 我有一个元素和多个样式,如何在运行时以编程方式或通过XAML绑定在样式之间切换.
<Rectangle x:Name="fixtureControl" Style="{DynamicResource FixtureStyle_Fast}">
<!-- In the style resources. -->
<Style x:Key="FixtureStyle_Fast" TargetType="{x:Type Shape}">
<Setter Property="Stroke" Value="Black"/>
<Setter Property="StrokeThickness" Value="20"/>
</Style>
<Style x:Key="FixtureStyle_Good" TargetType="{x:Type Shape}">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Opacity=".9"
Direction="-90"
RenderingBias="Performance"
BlurRadius="50"
ShadowDepth="10" />
</Setter.Value>
</Setter>
</Style>
<Style x:Key="FixtureStyle_Best" TargetType="{x:Type Shape}">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Opacity=".9"
Direction="-90"
RenderingBias="Quality"
BlurRadius="50"
ShadowDepth="10" />
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
然后我有一些处理器改变风格的单选按钮
private void RadioButton_Click(object sender, RoutedEventArgs e) {
if (e.Source == rdoQualityBest) {
fixtureControl.Style = FindResource("FixtureStyle_Best") as Style;
} else if (e.Source == rdoQualityGood) …Run Code Online (Sandbox Code Playgroud) 我希望在Git历史记录中更新用户的用户名,这可能吗?
这是我的一个大错,我刚刚从CVS迁移到没有意识到直到每个人都开始使用Git repo我错过了一些用户名.
我发现自己经常写代理,这些代理采用常见的参数或返回类型.因此我经常发现自己使用这样的代表:
public delegate void CommonVoidEmptyDelegate();
public delegate void CommonVoidDelegate<TParam>(TParam p);
public delegate void CommonVoidParamDelegate<TParam>(params TParam[] p);
public delegate TReturn CommonEmptyDelegate<TReturn, TParam>(TParam p);
public delegate TReturn CommonParamDelegate<TReturn, TParam>(params TParam[] p);
Run Code Online (Sandbox Code Playgroud)
我不想在每个项目中定义这些,而是想知道框架中是否存在我可以使用的常见内容.
我希望创建一个带标题栏和按钮栏的窗口,但不希望使用选项卡组.
我尝试了以下但没有成功:
var win = Titanium.UI.createWindow({
title: "Home",
backgroundColor: '#bbb',
navBarHidden:false
});
var b = Titanium.UI.createButton({
title:'Button',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
win.setToolbar([b]);
win.add(Titanium.UI.createLabel({text: "Label"}));
win.open();
Run Code Online (Sandbox Code Playgroud)
工具栏或标题都不会显示,但是如果我将此内容放在其中TabGroup,则按预期运行.
如果我默认情况下无法获得此行为,有人可以演示如何使用系统呈现的标题样式创建标签(或按钮),是否可以执行类似的操作以获取底部的按钮栏?
以下工作:
var win = Titanium.UI.createWindow({
title: "Home",
backgroundColor: '#bbb',
navBarHidden:false
});
var b = Titanium.UI.createButton({
title:'Button',
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED
});
win.setToolbar([b]);
win.add(Titanium.UI.createLabel({text: "Label"}));
var tabGroup = Titanium.UI.createTabGroup();
tabGroup.addTab(Titanium.UI.createTab({
title:'Home',
window:win
}));
tabGroup.open();
Run Code Online (Sandbox Code Playgroud)