小编Pat*_*ick的帖子

Spring Beans:扫描转换器,注入CustomConversionServiceFactory

我有一个我正在注册的MyAppConversionServiceFactoryBean:

<bean id="conversionService" class="com.MyProject.MyAppConversionServiceFactoryBean">
    <property name="messageSource" ref="messageSource"/>
    <property name="converters">
        <set>
            <bean class="com.MyProject.XRepresentationConverter" />
            <bean class="com.MyProject.YRepresentationConverter" />
            <bean class="com.MyProject.ZRepresentationConverter" />
        </set>
    </property>
</bean>
Run Code Online (Sandbox Code Playgroud)

我可以继续列出我们写入此列表的每个转换器,但我希望能够配置它,这样就不需要了,并且转换器会以某种方式自动注册到我的工厂.

侧栏1:如果使用自定义工厂无法实现,是否可以使用默认弹簧?

侧栏2:如果第一部分和侧边栏1都不可能,@Autowired转换服务是否可以转换为转换器(这样它们可以轻松地相互调用)?尝试@Autowired ConversionService conversionService之前给我的问题是由于在仍然忙于创建服务时无法将conversionService连接到对象.

注意:我们使用的是Spring,而不是Spring MVC.我对此无法控制,因此该路线上的任何解决方案都将无法使用.我几乎可以改变有关配置和Java类的任何其他内容,而不是更重要的工具.

java configuration spring javabeans

6
推荐指数
1
解决办法
2175
查看次数

Arbitrarily嵌套子资源中的Jersey @Ref(声明性超链接)

我已经搜索了很多东西,并试图深入研究泽西岛的源代码,但据我所知,泽西岛不支持任意深度嵌套子资源和@Ref注释.

这是我的设置:

MemberResource.java

@Component // Spring managed
@Scope("prototype")
@Validated
@Path("/member")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class MemberResource extends BaseResource {

    @Autowired // Spring is injecting this sub resource
    private MemberFriendResource memberFriendResource;

    @Path("/{memberId}/friend/")
    public MemberFriendResource getMemberFriendResource() {
        return memberFriendResource;
    }

}
Run Code Online (Sandbox Code Playgroud)

MemberFriendResource.java

@Component // Spring managed
@Scope("prototype")
@Validated
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class MemberFriendResource extends BaseResource {

    @GET
    public JResponse<FriendListRepresentation> getAllFriends() {
        // Code
    }


    @GET
    @Path("/recent")
    public JResponse<FriendListRepresentation> getRecentFriends() {
        // Code
    }
}
Run Code Online (Sandbox Code Playgroud)

MemberRepresentation.java

public class MemberRepresentation { …
Run Code Online (Sandbox Code Playgroud)

java rest jersey

5
推荐指数
0
解决办法
695
查看次数

IntelliJ IDEA:后台任务视图包含乱码/失真文本

出现我的后台任务视图,其中包含以下乱码或扭曲的文本.我几乎可以看出一些任务的名称,但显然这不是预期的,也不是最佳的.只要我有IntelliJ IDEA(我认为我的第一个版本是11.我目前正在使用12.1),但是还没有尝试解决它.

这是一些字体设置我错了,我该怎么办才能修复它?

IntelliJ中的乱码文本

intellij-idea

5
推荐指数
1
解决办法
2069
查看次数

在EXTJS3中的ComboBox中的选项之间添加分隔线

我试图在extjs 3.4中的组合框中的选项之间添加一行.我可以添加该行但不能从我的远程位置填充我的数据.(如果我删除修改后的tpl选项,它会填充).

这是我的代码.我只需要在'group'字段之间添加一行,所以说我有3个不同的字段,各种长度,我需要将它们分开.

我刚刚开始学习模板,api和谷歌搜索还没有多少帮助,所以在询问时.感谢您提供的任何指导.

此外一些代码试图使用api或其他论坛没有运气.

var recipientStore = new Ext.data.Store ({
        autoload: false,
        url: '../../../messaging/inc/action.php?list=to_options',
        reader: new Ext.data.JsonReader ({
            root: 'to_options',
            id: 'id',
            fields: ['id', 'name', 'group']
        })
    });

    var setRecipient = new Ext.form.ComboBox ({
        fieldLabel: 'To',
        store: recipientStore,
        mode: 'local',
        valueField: 'id',
        displayField: 'name',
        editable: false,
        width: 150,
        triggerAction: 'all',
        value: 'group',
        tpl: '<tpl for = "."><div ext:gtip="{value}" class="x-combo-list-item">{value}</div><tpl if = "xindex == 2"><hr /></tpl></tpl>'
    });
Run Code Online (Sandbox Code Playgroud)

combobox extjs3

3
推荐指数
1
解决办法
4291
查看次数