- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个spring-boot项目,并且正在使用spring数据。我的build.gradle文件看起来像这样。如您所见,我通过manual完成了所有操作(嗯,显然不是所有操作)。
我想要的是具有/ profile链接并能够获取我正在发布的所有端点的json模式。相反,我有/ apls链接。因此,我已经检查了<2.4版本的spring-data-rest手册,并且没有提到/ profile链接或json-schema。所以我发现我没有使用最新版本的spring-data-rest。
我已经添加了spring boot gradle插件,并且没有为spring-boot-data-rest依赖关系指定版本。我还尝试添加org.springframework.data:spring-data-rest-webmvc:2.4.0.RELEASE依赖项。
但这显然不起作用,因为我仍然拥有/ alps链接而不是/ profile链接。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'settings'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
dependencies {
compile group: 'org.zeromq', name: 'jeromq', version: '0.3.5'
compile group: 'org.json', name: 'json', version: '20141113'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
compile group: 'org.skyscreamer', name: 'jsonassert', version: '1.2.3'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-hateoas'
compile group: 'postgresql', name: 'postgresql', version:'9.1-901-1.jdbc4'
compile("org.springframework.data:spring-data-rest-webmvc:2.4.0.RELEASE")
runtime group: 'com.h2database', name: 'h2', version:'1.4.187'
testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude(module: 'commons-logging')
}
}
compile("org.springframework.data:spring-data-rest-webmvc:2.4.0.RELEASE")
package demo;
import demo.settings.DemoApplication;
import demo.settings.processing.Channel;
import demo.settings.processing.ChannelMode;
import demo.settings.processing.ChannelsController;
import demo.settings.processing.ChannelRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import java.util.List;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DemoApplication.class)
public class DemoApplicationTests {
final String BASE_URL = "http://localhost:8080/";
private MockMvc mockMvc;
@Autowired
private ChannelsController controller;
@Autowired
private ChannelRepository repository;
@Before
public void setup() {
this.mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
}
@Test
public void setChannels() {
Channel exampleChannel = new Channel(ChannelMode.AUTO, 1, 1, 1, false, 0);
controller.setChannels(0, 10, exampleChannel);
List<Channel> allChannels = repository.findAllByOrderByBinIndexAsc();
for (int i = 0; i <= 10; i++) {
Channel ch = allChannels.get(i);
assertEquals(ch.getBinIndex(), i);
assertEquals(ch.getC1(), exampleChannel.getC1(), 0);
assertEquals(ch.getC2(), exampleChannel.getC2(), 0);
assertEquals(ch.getManualCoefficient(), exampleChannel.getManualCoefficient(), 0);
assertEquals(ch.getMode().toString(), exampleChannel.getMode().toString());
assertEquals(ch.isExcluded(), exampleChannel.isExcluded());
}
exampleChannel.setC1(100);
controller.setChannels(0, 11, exampleChannel);
allChannels = repository.findAllByOrderByBinIndexAsc();
for (int i = 0; i <= 11; i++) {
Channel ch = allChannels.get(i);
assertEquals(ch.getBinIndex(), i);
assertEquals(ch.getC1(), exampleChannel.getC1(), 0);
assertEquals(ch.getC2(), exampleChannel.getC2(), 0);
assertEquals(ch.getManualCoefficient(), exampleChannel.getManualCoefficient(), 0);
assertEquals(ch.getMode().toString(), exampleChannel.getMode().toString());
assertEquals(ch.isExcluded(), exampleChannel.isExcluded());
}
}
}
@RepositoryRestResource(path="dts_stm32_settings")
interface DtsStm32SettingsRepository extends PagingAndSortingRepository<DtsStm32Settings, Long> {
}
package demo.settings.data_collection.stm;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* Created by michael on 11/09/15.
*/
@Entity
public class DtsStm32Settings extends Stm32Settings {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@NotNull @Min(value=0) @Max(value=65535)
private int firstChannelDac;
@NotNull @Min(value=0) @Max(value=65535)
private int secondChannelDac;
@NotNull @Min(value=0) @Max(value=65535)
private int dil;
@NotNull
private CommutatorChannel commutatorChannel;
@NotNull @Min(value=0) @Max(value=65535)
private int firstChannelPwm;
@NotNull @Min(value=0) @Max(value=65535)
private int zeroChannelPwm;
public DtsStm32Settings() {
}
public DtsStm32Settings(
int firstChannelShift,
int secondChannelShift,
int firstChannelGain,
int secondChannelGain,
int firstChannelSlope,
int secondChannelSlope,
boolean led,
boolean firstChannelDurationBit,
boolean secondChannelDurationBit,
int firstChannelDac,
int secondChannelDac,
int dil,
CommutatorChannel commutatorChannel,
int firstChannelPwm,
int zeroChannelPwm,
boolean pulsedPumpMode,
int durationOn,
int durationOff
) {
super(firstChannelShift, secondChannelShift, firstChannelGain, secondChannelGain, firstChannelSlope, secondChannelSlope, led, firstChannelDurationBit, secondChannelDurationBit);
this.firstChannelDac = firstChannelDac;
this.secondChannelDac = secondChannelDac;
this.dil = dil;
this.commutatorChannel = commutatorChannel;
this.firstChannelPwm = firstChannelPwm;
this.zeroChannelPwm = zeroChannelPwm;
this.pulsedPumpMode = pulsedPumpMode;
this.durationOn = durationOn;
this.durationOff = durationOff;
}
@NotNull
private boolean pulsedPumpMode;
@NotNull @Min(value=1) @Max(value=65535)
private int durationOn;
@NotNull @Min(value=0) @Max(value=65535)
private int durationOff;
public int getFirstChannelPwm() {
return firstChannelPwm;
}
public void setFirstChannelPwm(int firstChannelPwm) {
this.firstChannelPwm = firstChannelPwm;
}
public int getZeroChannelPwm() {
return zeroChannelPwm;
}
public void setZeroChannelPwm(int zeroChannelPwm) {
this.zeroChannelPwm = zeroChannelPwm;
}
public int getFirstChannelDac() {
return firstChannelDac;
}
public void setFirstChannelDac(int firstChannelDac) {
this.firstChannelDac = firstChannelDac;
}
public int getSecondChannelDac() {
return secondChannelDac;
}
public void setSecondChannelDac(int secondChannelDac) {
this.secondChannelDac = secondChannelDac;
}
public int getDil() {
return dil;
}
public void setDil(int dil) {
this.dil = dil;
}
public CommutatorChannel getCommutatorChannel() {
return commutatorChannel;
}
public void setCommutatorChannel(CommutatorChannel commutatorChannel) {
this.commutatorChannel = commutatorChannel;
}
public boolean isPulsedPumpMode() {
return pulsedPumpMode;
}
public void setPulsedPumpMode(boolean pulsedPumpMode) {
this.pulsedPumpMode = pulsedPumpMode;
}
public int getDurationOn() {
return durationOn;
}
public void setDurationOn(int durationOn) {
this.durationOn = durationOn;
}
public int getDurationOff() {
return durationOff;
}
public void setDurationOff(int durationOff) {
this.durationOff = durationOff;
}
}
package demo.settings.data_collection.stm;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* Created by michael on 11/09/15.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS, include=JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({@JsonSubTypes.Type(DtsStm32Settings.class)})
abstract class Stm32Settings {
@NotNull
@Min(value=0) @Max(value=65535)
protected int firstChannelShift;
@NotNull
@Min(value=0) @Max(value=65535)
protected int secondChannelShift;
@NotNull
@Min(value=0) @Max(value=65535)
protected int firstChannelGain;
@NotNull
@Min(value=0) @Max(value=65535)
protected int secondChannelGain;
@NotNull
@Min(value=0) @Max(value=65535)
protected int firstChannelSlope;
@NotNull
@Min(value=0) @Max(value=65535)
protected int secondChannelSlope;
@NotNull
protected boolean led;
@NotNull
protected boolean firstChannelDurationBit;
@NotNull
protected boolean secondChannelDurationBit;
protected Stm32Settings() {
}
public int getFirstChannelShift() {
return firstChannelShift;
}
public void setFirstChannelShift(int firstChannelShift) {
this.firstChannelShift = firstChannelShift;
}
public int getSecondChannelShift() {
return secondChannelShift;
}
public void setSecondChannelShift(int secondChannelShift) {
this.secondChannelShift = secondChannelShift;
}
public int getFirstChannelGain() {
return firstChannelGain;
}
public void setFirstChannelGain(int firstChannelGain) {
this.firstChannelGain = firstChannelGain;
}
public int getSecondChannelGain() {
return secondChannelGain;
}
public void setSecondChannelGain(int secondChannelGain) {
this.secondChannelGain = secondChannelGain;
}
public int getFirstChannelSlope() {
return firstChannelSlope;
}
public void setFirstChannelSlope(int firstChannelSlope) {
this.firstChannelSlope = firstChannelSlope;
}
public int getSecondChannelSlope() {
return secondChannelSlope;
}
public void setSecondChannelSlope(int secondChannelSlope) {
this.secondChannelSlope = secondChannelSlope;
}
public boolean isLed() {
return led;
}
public void setLed(boolean led) {
this.led = led;
}
public boolean isFirstChannelDurationBit() {
return firstChannelDurationBit;
}
public void setFirstChannelDurationBit(boolean firstChannelDurationBit) {
this.firstChannelDurationBit = firstChannelDurationBit;
}
public boolean isSecondChannelDurationBit() {
return secondChannelDurationBit;
}
public void setSecondChannelDurationBit(boolean secondChannelDurationBit) {
this.secondChannelDurationBit = secondChannelDurationBit;
}
public Stm32Settings(
int firstChannelShift,
int secondChannelShift,
int firstChannelGain,
int secondChannelGain,
int firstChannelSlope,
int secondChannelSlope,
boolean led,
boolean firstChannelDurationBit,
boolean secondChannelDurationBit
) {
setFirstChannelShift(firstChannelShift);
setSecondChannelShift(secondChannelShift);
setFirstChannelGain(firstChannelGain);
setSecondChannelGain(secondChannelGain);
setFirstChannelSlope(firstChannelSlope);
setSecondChannelSlope(secondChannelSlope);
setLed(led);
setFirstChannelDurationBit(firstChannelDurationBit);
setSecondChannelDurationBit(secondChannelDurationBit);
}
}
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stm32Controller': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private demo.settings.data_collection.stm.DtsStm32SettingsRepository demo.settings.data_collection.stm.Stm32Controller.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dtsStm32SettingsRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.repository.core.support.RepositoryFactorySupport.getTargetRepository(Lorg/springframework/data/repository/core/RepositoryInformation;)Ljava/lang/Object;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:104)
at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:68)
at org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:86)
... 45 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private demo.settings.data_collection.stm.DtsStm32SettingsRepository demo.settings.data_collection.stm.Stm32Controller.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dtsStm32SettingsRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.repository.core.support.RepositoryFactorySupport.getTargetRepository(Lorg/springframework/data/repository/core/RepositoryInformation;)Ljava/lang/Object;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 60 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dtsStm32SettingsRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.data.repository.core.support.RepositoryFactorySupport.getTargetRepository(Lorg/springframework/data/repository/core/RepositoryInformation;)Ljava/lang/Object;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
... 62 more
Caused by: java.lang.AbstractMethodError: org.springframework.data.repository.core.support.RepositoryFactorySupport.getTargetRepository(Lorg/springframework/data/repository/core/RepositoryInformation;)Ljava/lang/Object;
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:185)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
... 72 more
最佳答案
尝试指定Spring Data发布火车,而不是:
dependencyManagement {
imports {
...
mavenBom "org.springframework.data:spring-data-releasetrain:Gosling-RELEASE"
}
}
关于gradle - 如何在spring-boot项目中指定spring-data-rest版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33052781/
我正在我的 java 作业中使用 GUI,并且我必须指定 JCheckBox 中的其他内容。除了这个小要求,其他的我都完成了。我不太确定如何解决这个问题,我查阅了我的书并尝试在线研究 要求: 一系列复
在各种语言中(我将在这里使用 JavaScript,但我已经在 PHP 和 C++ 中以及可能在其他地方看到过它),似乎有几种构造简单 for 循环的方法。版本 1 如下: var top = doc
有没有一种方法可以使用 CSS 指定每次“小于符号”(在键盘上 M 的右侧)或“大于符号”出现在文本中时,它应该被替换为分别是“小于”或“大于”的实际词? 最佳答案 CSS 不能作用于(不能修改,即)
首先,使用 setspn 命令为用户注册服务主体名称。 setspn -a CS/dummy@abc.com dummyuser setspn -l dummyuser 给出输出为 CS/dummy@
我在指定从 SFSafariViewController 访问时遇到问题,因为它具有与 Safari 浏览器完全相同的用户代理。 我要做的是仅在 webview 内显示图片,如果在普通浏览器上查看,则
我正在尝试用 R 语言在 lavaan 中指定一个奇怪的模型。该模型如下所示: 我的规范尝试如下所示。我发现难以实现的是将观察到的变量的唯一误差固定为唯一项的两个相关性的总和。 例如,项目 y*1,2
我正在构建 API 以将我的 React 应用程序与我的后端服务连接起来,我想使用 typescript 来指定 data 的类型在我的 Axios 请求中。如何在不修改其他字段的情况下更新 Axio
如何为模型指定初始“软”值?该初始模型是解决类似查询的结果,并且该模型很可能具有正确的部分,甚至对于当前查询可能是正确的。 目前,我正在通过增量求解和 hard/soft constraints 对此
我有来自网页的以下代码 https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+Producer+Example 似乎缺少的是如何配置分区数。我
有没有办法在每个查询的基础上在 Neo4jClient 中指定 Cypher 解析器的版本,如 here 所述? 谢谢! 最佳答案 如果您将 Neo4jClient 更新到最新版本(> 1.0.0.6
我有以下代码生成四个图,但它们最终被压扁(见下图)。我该如何解决这个问题? par(mfrow=c(2,2)) curve(.5*exp(-.5*x),from=0,to=10,main="f(x)"
我有一个 ColdFusion 10 服务器。我正在使用 JDBC 驱动程序连接到 db2 数据库。我偶然发现了这个笔记。这个设置在哪里?我还查看了 neo*.xml 文件,但没有看到任何 db 驱动
我想知道是否可以指定验证器的运行顺序。 目前,我编写了一个自定义验证器,检查它是否为 [a-zA-Z0-9]+ 以确保登录验证我们的规则,并编写了一个远程验证器以确保登录可用,但目前远程验证器已启动在
我的应用程序需要至少 40MB 的 RAM,因此早期的 iPhone(例如 3G、第一个 iPod touch 版本)就没有它(它们为我的应用程序提供的最大内存约为 20MB)。有没有正确的方法来禁用
我有一个保存日期(不是当前日期)的 Date 对象,我需要以某种方式指定该日期为 UTC,然后将其转换为“欧洲/巴黎”,即 +1 小时。 public static LocalDateTime toL
我想问你在 Varnish 代码中如何在没有缓存的情况下将请求传递到后端。 我知道我可以做到并且正在发挥作用: if (req.url ~ "(\?|&)(something|somethin
我目前基于模块编译程序(如主程序 foo 依赖于模块 bar )如下: gfortran -c bar.f90 gfortran -o foo.exe foo.f90 bar.o 这在 foo.f90
我正在尝试创建一个依赖于另一个 meteor 包的新 meteor 包。当我尝试 meteor add mypackage 时,出现以下错误。为什么 Meteor 不添加 mypackage 并引入它
我正在制作执行器/ react 器,同时发现这是一个终生的问题。它与 async/Future 无关,可以在没有 async 糖的情况下进行复制。 use std::future::Future; s
我在 cassandra 中有一个表,其数据类型为时间戳。我正在使用 cqlsh 从数据库中获取数据,并希望更改我的时间戳列输出的输出格式。我研究了一下,发现我可以通过更改以下文件来更改时间戳输出格式
我是一名优秀的程序员,十分优秀!