小编kar*_*arq的帖子

Spring自动挂载列表

是否可以使用@Autowired列表?

就像我有mimetypes属性文件一样,在我的类文件中我有这样的东西

@Autowired
private List<String> mimeTypes = new ArrayList<String>();
Run Code Online (Sandbox Code Playgroud)

spring list autowired

29
推荐指数
4
解决办法
5万
查看次数

GWT测试错误NoClassDefFoundError:com/google/gwt/dev/cfg/Condition

也许有人可以帮助我,我正在尝试编写我的第一个gwt单元测试,但是这是问题,当我用maven运行我的测试时我得到了这个错误:

>  java.lang.NoClassDefFoundError: com/google/gwt/dev/cfg/Condition     at
> com.google.gwt.junit.client.GWTTestCase.createStrategy(GWTTestCase.java:340)
>   at
> com.google.gwt.junit.client.GWTTestCase.getStrategy(GWTTestCase.java:257)
>   at
> com.google.gwt.junit.client.GWTTestCase.getSyntheticModuleName(GWTTestCase.java:275)
>   at
> com.google.gwt.junit.client.GWTTestCase.setName(GWTTestCase.java:321)
>   at junit.framework.TestSuite.createTest(TestSuite.java:63)  at
> junit.framework.TestSuite.addTestMethod(TestSuite.java:283)   at
> junit.framework.TestSuite.&lt;init&gt;(TestSuite.java:146)    at
> org.junit.internal.runners.JUnit38ClassRunner.&lt;init&gt;(JUnit38ClassRunner.java:71)
>   at
> org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:14)
>   at
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
>   at
> org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
>   at
> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
>   at
> org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
>   at
> org.apache.maven.surefire.junit4.JUnit4TestSet.&lt;init&gt;(JUnit4TestSet.java:45)
>   at
> org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
>   at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
>   at
> org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)
>   at org.apache.maven.surefire.Surefire.run(Surefire.java:156)    at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at
> …
Run Code Online (Sandbox Code Playgroud)

testing gwt

9
推荐指数
3
解决办法
4261
查看次数

使用Jquery $ .get()逐行检索文本文件

是否可以逐行检索txt文件内容?

现在我正在使用这段代码:

var file = "http://plapla.com/pla.txt";
function getFile(){
     $.get(file,function(txt){
        save(txt.responseText);
 }); 
}
Run Code Online (Sandbox Code Playgroud)

save函数将内容保存到变量中.在我打印出来之后,所有已重复文件的内容都在彼此的末尾(不是逐行).

ajax jquery cross-domain

6
推荐指数
2
解决办法
3万
查看次数

Spring + hibernate懒惰抓取

我有org.hibernate.LazyInitializationException的问题:懒得初始化一个角色集合.

如何使用gwt + spring + hibernate实现延迟抓取?

这是我的appContext:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="   http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd   http://www.springframework.org/schema/context   http://www.springframework.org/schema/context/spring-context-3.0.xsd   http://www.springframework.org/schema/tx   http://www.springframework.org/schema/tx/spring-tx-3.0.xsd   http://www.springframework.org/schema/aop    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory">
            <ref local="sessionFactory"/>
        </property>
    </bean>
    <context:annotation-config/>
    <context:component-scan base-package="com.yeah.server.*"/>
    <aop:aspectj-autoproxy/>
    <!--Mysql database connection info-->
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://192.168.1.4:3306/YeaH"/>
        <property name="username" value="root"/>
        <property name="password" value=""/>
    </bean>
    <!-- Hibernate -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="mappingResources">
            <list>
                <value>com/yeah/shared/model/User.hbm.xml</value>
                <value>com/yeah/shared/model/Comment.hbm.xml</value>
                <value>com/yeah/shared/model/Album.hbm.xml</value>
                <value>com/yeah/shared/model/Picture.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop …
Run Code Online (Sandbox Code Playgroud)

gwt spring hibernate lazy-evaluation

4
推荐指数
1
解决办法
1935
查看次数

Spring 3单元测试

我正在尝试为我的DAO类编写单元测试,但问题是我收到此错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name  'com.yeah.server.dao.UserDAOTest': Injection of autowired dependencies failed; nested   exception is org.springframework.beans.factory.BeanCreationException: Could not autowire   field: private com.yeah.server.dao.UserDAO com.yeah.server.dao.UserDAOTest.userDAO; nested   exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.yeah.server.dao.UserDAO] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Run Code Online (Sandbox Code Playgroud)

这是我的applicationContext文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
 http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 http://www.springframework.org/schema/context
 http://www.springframework.org/schema/context/spring-context-3.0.xsd
 http://www.springframework.org/schema/tx
 http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
 http://www.springframework.org/schema/aop 
 http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

<bean id="hibernateTemplate"     class="org.springframework.orm.hibernate3.HibernateTemplate">
    <property name="sessionFactory">
        <ref local="sessionFactory" /> …
Run Code Online (Sandbox Code Playgroud)

junit spring hibernate autowired

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