如何使用h2设置Spring Boot存储库?

时间:2015-10-19 08:00:20

标签: java spring spring-boot repository h2

我尝试使用Spring Boot Repository,就像这个YouTube教程(https://www.youtube.com/watch?v=4bPT-0f-am4)中的人一样,但我总是得到一个NullPointerException:

#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <string.h>

int _tmain(int argc, _TCHAR* argv[])
{
   char *code = new char[];
   char *ret1 = NULL;
   char *ret2 = NULL;
   int flag = 0;
   printf("                !!!!!!!!\n");
   printf("               !!      !!\n");
   printf("              !!        !!\n");
   printf("              !!        !!\n");
   printf("              !!        !!\n");
   printf("            !!!!!!!!!!!!!!!!\n");
   printf("            !!!!!!!!!!!!!!!!               ####\n");
   printf("            !!!!!!!  !!!!!!!   #############  #\n");
   printf("            !!!!!!!  !!!!!!!   # #         ####\n");
   printf("            !!!!!!!  !!!!!!!   # #\n");
   printf("            !!!!!!!!!!!!!!!!\n");
   printf("            !!!!!!!!!!!!!!!!\n");
   printf("\n     This program is key-protected.\n");
   printf("  Please enter the 10-digit key to unlock:  ");
   do {
     std::cin >> code;
     if(std::strlen(code) == 10){
     ret1 = std::strchr(code, 'c');
     ret2 = std::strchr(code, 'r');
     std::cout << (char *) ret1;
     flag = 1;
   }
   else
     std::cout << "Wrong key. Try again:  ";
   } while(flag == 0);
   printf("\n                !!!!!!!!\n");
   printf("               !!      !!\n");
   printf("              !!        !!\n");
   printf("              !!        !!\n");
   printf("              !!        !!\n");
   printf("              !!\n");
   printf("            !!!!!!!!!!!!!!!!\n");
   printf("            !!!!!!!!!!!!!!!!   ####\n");
   printf("            !!!!!!!#############  #\n");
   printf("            !!!!!!!##!!!!!!!   ####\n");
   printf("            !!!!!!!##!!!!!!!\n");
   printf("            !!!!!!!!!!!!!!!!\n");
   printf("            !!!!!!!!!!!!!!!!\n");
   printf("\n     Congratulations! You made it!");
   getchar();
}

SBSettingServiceBean:

java.lang.NullPointerException
        at de.services.DBSettingServiceBean.findOne(DBSettingServiceBean.java:24)
        at de.sps.DatabaseManagerUi.configureComponents(DatabaseManagerUi.java:63)

DatabaseManagerUi:

@Service
public class DBSettingServiceBean implements DBSettingService {

@Autowired
private DBSettingRepository dbSettingRepository;

@Override
public Collection<DBSetting> findAll() {
    return dbSettingRepository.findAll();
}

@Override
public DBSetting findOne(Long id) {
    System.out.println(dbSettingRepository);
    return dbSettingRepository.findOne(id);
}

DBSettingRepository:

private DBSettingServiceBean dbssb = new DBSettingServiceBean();
DBSetting dbs = dbssb.findOne(1L);

0 个答案:

没有答案