我有 rest crud 服务,它将帮助我发布和获取请求并从 sql server 接收响应,在我的 application.properties 中,我使用类似的数据:
server.port=9004
spring.datasource.url=jdbc:sqlserver://localhost/1433;databaseName=test1
spring.datasource.username=sa
spring.datasource.password=*****
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2014Dialect
spring.jpa.hibernate.ddl-auto =ddl-auto
Run Code Online (Sandbox Code Playgroud)
这是我的 POM:
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.6.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
当我将它作为 Java 项目运行时,我总是收到此错误:
引起:org.springframework.beans.factory.BeanCreationException:无法自动装配字段:private org.springframework.boot.autoconfigure.web.HttpMessageConverters org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.messageConverters; 嵌套异常是
和:
在类路径资源中定义了名称“mappingJackson2HttpMessageConverter”[org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration.class]:通过构造函数参数表达的不满意的依赖关系,类型为 [com.fasterxml.jackson.databind.ObjectMapper] :创建名为“objectMapper”的 bean 在类路径资源 [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class] 中定义时出错:通过工厂方法的 Bean 实例化失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:无法实例化 [com.fasterxml.jackson.databind.ObjectMapper]:工厂方法“objectMapper”抛出异常;嵌套异常是 org.springframework.beans。factory.BeanCreationException:在类路径资源 [org/springframework/boot/autoconfigure/data/rest/SpringBootRepositoryRestMvcConfiguration.class] 中定义名称为“config”的 bean …
我想知道线程在nifi中是如何工作的,我是说一个处理器有一个线程还是它们在一个主线程中?也许我想从处理器获取一个文件,然后再更新
我尝试使用Java File锁,但是在我的代码看来似乎无法正常工作,
File file = new File("C://Users//user//Desktop//try2//nifi-
1.3.0//4//conf2.xml");
String content = "";
String material = "";
BufferedReader s;
BufferedWriter w;
int m;
RandomAccessFile ini = new RandomAccessFile(file, "rwd");
FileLock lock = ini.getChannel().lock();
DocumentBuilder dBuilder;
Document document, doc;
String date="";
String data="";
boolean make = false;
try {
String sCurrentLine;
s = new BufferedReader(Channels.newReader(ini.getChannel(), "UTF-8"));
while ((sCurrentLine = s.readLine()) != null) {
content += sCurrentLine;
}
ini.seek(0);
Run Code Online (Sandbox Code Playgroud)