我正在尝试将自定义方法添加到我的Spring Data存储库PersonRepository,如1.3 Spring Data存储库的自定义实现中所述,并通过REST公开这些方法.初始代码来自使用REST示例访问JPA数据,以下是添加/修改类的代码:
interface PersonRepositoryCustom {
List<Person> findByFistName(String name);
}
class PersonRepositoryImpl implements PersonRepositoryCustom, InitializingBean {
@Override
public void afterPropertiesSet() throws Exception {
// initialization here
}
@Override
public List<Person> findByFistName(String name) {
// find the list of persons with the given firstname
}
}
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface PersonRepository extends PagingAndSortingRepository<Person, Long> {
List<Person> findByLastName(@Param("name") String name);
}
Run Code Online (Sandbox Code Playgroud)
当我运行应用程序并访问时http://localhost:8080/portfolio/search/,我得到以下响应正文:
{
"_links" : {
"findByLastName" …Run Code Online (Sandbox Code Playgroud) 我在我的Windows 7机器上安装了JDK 1.7,安装JDK 1.8 u20后,我遇到以下错误:
C:\>java -version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
Run Code Online (Sandbox Code Playgroud)
我的PATH变量指向旧版本(即1.7).
这里有什么问题以及我如何使用java 8和java 7?
我有一个Spring Boot项目,我可以在IntelliJ中成功运行,但是当我打包一个可执行jar时,我再也无法运行它了.这是异常的堆栈跟踪:
18:13:55.254 [main] INFO o.s.c.a.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@b3d7190: startup date [Wed Sep 07 18:13:55 CEST 2016]; root of context hierarchy
18:13:55.403 [main] WARN o.s.c.a.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [el.dorado.App]; nested exception is java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
18:13:55.414 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to …Run Code Online (Sandbox Code Playgroud) 我有一个作为参数的方法v ...interface{},我需要在前面添加一个string.这是方法:
func (l Log) Error(v ...interface{}) {
l.Out.Println(append([]string{" ERROR "}, v...))
}
Run Code Online (Sandbox Code Playgroud)
当我尝试使用append()它不起作用:
> append("some string", v)
first argument to append must be slice; have untyped string
> append([]string{"some string"}, v)
cannot use v (type []interface {}) as type string in append
Run Code Online (Sandbox Code Playgroud)
在这种情况下,前置的正确方法是什么?
我有多个 PNG 图像文件,每个通道一个:红色、绿色、蓝色和黄色。
我如何将它们合并到一个 RBGA 图像中?
到目前为止我尝试了以下方法
from PIL import Image
red = Image.open('red.png')
green = Image.open('green.png')
blue = Image.open('blue.png')
yellow = Image.open('yellow.png')
rgb = Image.new('RGB', (blue.width, blue.height))
for im in [red, green, blue, yellow]:
rgb.paste(im, (0, 0))
rgb
Run Code Online (Sandbox Code Playgroud)
显然它不起作用,因为我只是覆盖了以前的图像。有任何想法吗?
更新:由于下面的评论,事实证明我可以将红色、绿色和蓝色文件合并为:
rgb = Image.merge("RGB",(red,green,blue))
Run Code Online (Sandbox Code Playgroud)
现在的问题是我如何使用黄色文件?
我正在尝试在ubuntu服务器机器上设置bosh-lite(然后在本地安装cloudfoundry)(vagrant v1.6.3,Virtualbox 4.3.20r96996).当vagrant尝试使用以下错误尝试引导创建的计算机时,安装失败:
$ cd bosh-lite
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'cloudfoundry/bosh-lite' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: …Run Code Online (Sandbox Code Playgroud) 我将keras模型定义如下
class ConvLayer(Layer) :
def __init__(self, nf, ks=3, s=2, **kwargs):
self.nf = nf
self.grelu = GeneralReLU(leak=0.01)
self.conv = (Conv2D(filters = nf,
kernel_size = ks,
strides = s,
padding = "same",
use_bias = False,
activation = "linear"))
super(ConvLayer, self).__init__(**kwargs)
def rsub(self): return -self.grelu.sub
def set_sub(self, v): self.grelu.sub = -v
def conv_weights(self): return self.conv.weight[0]
def build(self, input_shape):
# No weight to train.
super(ConvLayer, self).build(input_shape) # Be sure to call this at the end
def compute_output_shape(self, input_shape):
output_shape = (input_shape[0],
input_shape[1]/2,
input_shape[2]/2,
self.nf) …Run Code Online (Sandbox Code Playgroud) 我正确地设置了zkServer.cmd在Windows上启动Zookeeper时出现"JAVA_HOME设置错误"错误!当我发出%JAVA_HOME%我得到的C:\Program Files\Java\jdk1.7.0_45是java instalation的正确目录.
我怀疑问题是由于程序文件中的空间,因为当我发出%JAVA_HOME%\bin\java.exe(zkEnv.cmd中使用的命令)时,我得到了:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
windows command-line environment-variables java-home apache-zookeeper
我在Mac OS X Yosemite(10.10.4)上安装Docker时遇到麻烦:当我尝试使用Docker Toolbox中的Docker Quickstart终端时,我得到了这个:
. '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
bash-3.2$ . '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
Creating Machine default...
executing: /usr/local/bin/VBoxManage
STDOUT: Oracle VM VirtualBox Command Line Management Interface Version 5.0.2
(C) 2005-2015 Oracle Corporation
All rights reserved.
Usage:
VBoxManage [<general option>] <command>
STDERR:
Creating VirtualBox VM...
Creating SSH key...
Creating disk image...
Creating 20000 MB hard disk image...
Converting from raw image file="stdin" to file="/Users/arbi/.docker/machine/machines/default/disk.vmdk"...
Creating dynamic image with size 20971520000 bytes (20000MB)...
executing: /usr/local/bin/VBoxManage createvm --basefolder /Users/arbi/.docker/machine/machines/default --name default …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Docker(与Docker Toolbox for Mac一起安装)容器上运行mysql服务器,并从运行OS X Yosemite的机器访问它.来自官方仓库的文档没有解释如何从docker主机外部连接!!
我使用官方存储库创建了一个容器,如下所示:
$ docker pull mysql
$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
$ docker inspect CONTAINER_ID
Run Code Online (Sandbox Code Playgroud)
然后我得到了ip地址(172.17.0.1),但是当我ping它时,我看到超时!连接到正在运行的mysql服务器的适当方法是什么?
java ×3
docker ×2
macos ×2
python ×2
spring ×2
arrays ×1
boot2docker ×1
command-line ×1
go ×1
installation ×1
java-7 ×1
java-8 ×1
java-home ×1
jpa ×1
keras ×1
linux ×1
maven ×1
mysql ×1
prepend ×1
python-3.x ×1
rest ×1
rgba ×1
slice ×1
spring-boot ×1
spring-data ×1
tensorflow ×1
ubuntu ×1
vagrant ×1
virtualbox ×1
windows ×1