我已将应用程序的整个实体和存储库接口打包到一个 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) 我正在设置我的虚拟机Centos VM与vagrant.我正在建立一个公共网络.
config.vm.network :public_network, ip: "10.135.15.137"
Run Code Online (Sandbox Code Playgroud)
如何设置GATEWAY?
我在 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 循环执行的时间完全相同。
centos6 ×1
click ×1
foreach ×1
gateway ×1
java ×1
javascript ×1
jpa ×1
jquery ×1
knockout.js ×1
networking ×1
spring ×1
spring-boot ×1
vagrant ×1
virtualbox ×1