小编Rac*_*hel的帖子

@Autowiring不在Field Level工作

@Autowiring 我没有在领域工作,我得到:

错误:

         SEVERE: StandardWrapper.Throwable
        org.springframework.beans.factory.BeanCreationException: 
    Error creating bean with name 'contactController': 
    Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; …

java spring spring-mvc autowired

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

持久化到 Mongo 数据库时出现 NumberFormatException

我正在创建一个简单的VO对象,然后尝试将其持久化到 Mongo 数据库中,NumberFormatException最糟糕的是,对象本身没有抛出异常,因为现在我没有设置对象的任何属性,这个异常正在杀死我,我不确定怎么处理。

这是抛出异常的代码片段:

public void testAgenda(){
    ItemVO item = new ItemVO();
    try {
        item.persist();
    } catch (NumberFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        e.getCause();
        e.getMessage();
    }
Run Code Online (Sandbox Code Playgroud)

这是异常跟踪:

java.lang.RuntimeException:java.lang.NumberFormatException:对于输入字符串:“4e3c3da5fbb7d7b41ce9e394”
        在 com.google.code.morphia.mapping.Mapper.updateKeyInfo(Mapper.java:194)
        在 com.google.code.morphia.DatastoreImpl.postSaveOperations(DatastoreImpl.java:742)
        在 com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:645)
        在 com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:685)
        在 com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:679)
        在 com.williamblair.im.research.domain.vo.BaseDocument.persist(BaseDocument.java:68)
        在 com.williamblair.im.research.service.TestListService.testGetResearchAgenda_aroundBody2(TestListService.java:31)
        在 com.williamblair.im.research.service.TestListService$AjcClosure3.run(TestListService.java:1)
        在 org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
        在 com.williamblair.im.research.system.aop.profiling.ProfilingAspect.doProfiling(ProfilingAspect.java:36)
        在 com.williamblair.im.research.service.TestListService.testGetResearchAgenda(TestListService.java:26)
        在 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
        在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        在 java.lang.reflect.Method.invoke(Method.java:597)
        在 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        在 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        在 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        在 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        在 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        在 org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
        在 org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
        在 …

java exception morphia

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

在java编程中使用String被认为是邪恶的?

我试图理解String在编程过程中使用它是否有用,我们小组中普遍认为使用String是不好的做法而且enum是可行的但是我无法找到足够的理由来投票反对String并且会感激任何关于这个问题的想法和例子?

更新:

我应该重新说出我的问题,就像在什么情况下使用String邪恶以及dataType你应该使用什么替代品一样.

java string

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

Java:如何将Double连接到String

我怎么可以连接DoubleString在Java?

我有以下代码:

Double price = 5.34;
String trade = MSFT;
Run Code Online (Sandbox Code Playgroud)

现在我有String key = price + trade,不确定这是否是正确的做法,任何建议?

java

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

蜂巢中的分区和分区有什么区别?

我不清楚hive中分区和分区之间的区别,如果你可以通过示例提供一些细节,我将非常感激.

hadoop hive partitioning

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

Java字符串:Ascii值的问题

我有array of strings, String[] data,它的10个元素有价值P等等data[10]={java.lang.String@587}"P"

当我检查时data[10],我得到了data[10].value[0] = 'P' 80,我不确定那80是什么意思.

在我的程序中,我试图检查

if (data[10] == "P") {
    lookUp = data[7] + "." + data[8]+ "." + "Old";
} else if (data[10] == "C") {
    lookUpCode = data[7] + "." + data[8] + "." + "Old";
} else {
    lookUpCode = data[7] + "." + data[8];
}
Run Code Online (Sandbox Code Playgroud)

所以我在这里遇到的挑战是,即使data[10]="P"那时我打到最后else而不是第一次if循环,任何建议?

java arrays string

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

O(log n)复杂度中排序数组的中位数是多少?

O(log n)复杂度中排序数组的中位数是多少?

algorithm

-6
推荐指数
3
解决办法
9085
查看次数