小编deD*_*ari的帖子

无法将存储库从外部 Jar 自动装配到 Spring Boot App

我已将应用程序的整个实体和存储库接口打包到一个 jar 中。存储库是用@Repository 注释编写的:

@Repository
public interface InternalUserRepository extends JpaRepository<InternalUser, Long>{

}
Run Code Online (Sandbox Code Playgroud)

我已经将这个 jar 文件包含在我的 spring 启动应用程序中,并尝试从控制器自动连接这样的接口:

@RestController
public class AuthenticationController {

    @Autowired
    AuthenticationService authenticationService;

    @Autowired
    InternalUserRepository internalUserRepository;


    @GetMapping("/")
    public String home() {
        return "Hello World!";
    }

}
Run Code Online (Sandbox Code Playgroud)

我的主应用程序类是这样写的:

@SpringBootApplication
@EnableJpaRepositories
@ComponentScan("com.cdac.dao.cdacdao.*")
public class CdacAuthenticationMgntApplication {

public static void main(String[] args) {
    SpringApplication.run(CdacAuthenticationMgntApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)

存储库没有自动装配。当我启动 Spring boor 应用程序时,出现以下错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field internalUserRepository in 
com.cdac.user.cdacauthenticationmgnt.controller.AuthenticationController required a bean of type 'com.cdac.dao.cdacdao.repository.InternalUserRepository' that could not …
Run Code Online (Sandbox Code Playgroud)

java spring jpa spring-data-jpa spring-boot

7
推荐指数
2
解决办法
4163
查看次数

如何在流浪汉中建立公共网关

我正在设置我的虚拟机Centos VM与vagrant.我正在建立一个公共网络.

config.vm.network :public_network, ip: "10.135.15.137"
Run Code Online (Sandbox Code Playgroud)

如何设置GATEWAY?

networking virtualbox gateway vagrant centos6

5
推荐指数
2
解决办法
7716
查看次数

在 Knockout Foreach 中自动执行单击绑定

我在 foreach 循环中包含了一键绑定,如下所示:

    <tbody data-bind="foreach: locationConfigSet">
         <tr>
          <td data-bind="text: address"></td>
          <td><a data-bind="attr: {href: 'http://maps.google.com/maps?z=12&t=m&q=loc:' + latitude + '+' + longitude}" target="_blank" class="btn btn-primary btn-xs">Map</a></td>
          <td data-bind="text: allowance"></td>
          <td><button class="btn btn-danger btn-xs" data-bind="click: $parent.deleteconfig($data)">Delete</button></td>
         </tr>
    </tbody>
Run Code Online (Sandbox Code Playgroud)

但是,一旦页面在循环中加载(无需单击),函数 deleteconfig 就会立即执行,直到它执行的时间与 foreach 循环执行的时间完全相同。

javascript foreach jquery click knockout.js

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