在SQLite中,当我说:
CREATE TABLE my_table
(
my_column VARCHAR
);
Run Code Online (Sandbox Code Playgroud)
如果没有指定VARCHAR大小,使用的默认大小是多少?
我似乎无法在sqlite.org找到它或从我的数据库文件中找到它.
我知道,SQLite不强制尝试的东西时,大小varchar(500)为varchar(30),但有没有权衡在初始大小规格,什么是最好的做法?
是否可以在不使用任何Git仓库的情况下使用Spring Cloud Config?我正在尝试使用application.properties中的本地目录来测试它:
spring.cloud.config.server.git.uri=file://${user.dir}/src/main/resources/config-repo
但是我收到以下错误:
java.lang.IllegalStateException:文件中没有.git:// path/to/src/main/resources/config-repo
如果一个人根本不使用Git,那么就不可能使用Spring Cloud吗?
更新:
感谢Spencer的建议,我补充了以下内容:
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=${user.dir}/src/main/resources/configs
我在"configs"中有一个文件"bar.properties",其中包含以下内容:
foo: bar
Run Code Online (Sandbox Code Playgroud)
但我得到的反应不是读取文件:
{
"name": "bar",
"profiles": [
"default"
],
"label": "master",
"propertySources": []
}
Run Code Online (Sandbox Code Playgroud)
我正在使用的URL是http:// localhost:8888/bar/default
我错过了别的什么吗?再次感谢您!
使用Eureka Server运行配置服务器时,建议的配置是什么?Config Server应该是Eureka的客户吗?或者Eureka是否应该依赖Config Server属性进行配置?或者两个都好吗?
简短的故事:我正在寻找教程或github项目,其中有一个RESTful服务设计"最佳实践"的例子.
长篇故事:我正在阅读设计和实现Web服务的"官方"Spring教程:http: //spring.io/guides/tutorials/rest
它有一个小项目的例子.他们正在为这个项目使用"六边形架构"和一堆"事件"类.通过它,我不禁注意到,对于一个示例项目来说,它似乎过于设计.有50多个课程,不包括测试.这真的是这种服务的"最佳实践"范例吗?如果没有,还有其他更好的例子吗?
我正在尝试使用下面的 pom 创建一个 Spring cloud Eureka 服务器,主要来自 https://github.com/joshlong/service-registration-and-discovery
但是,我收到“创建名为 'viewControllerHandlerMapping' 的 bean 时出错”错误,由“java.lang.IllegalStateException:如果当前未启动资源可能无法访问”引起。
我认为这可能与拉取的各种 Jersey 组件的版本为 1.11 和 1.13 有关,尽管我没有看到任何单个 jar 被拉取两次。除此之外,我不知道为什么。有任何想法吗?提前致谢!
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.my.cloudconfig</groupId>
<artifactId>eureka</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>eureka</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
<version>1.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.2.7</version>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
编辑
应用类:
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication
{
public static void main(String[] …Run Code Online (Sandbox Code Playgroud) 我正试图找出一种在本地上传和提供文件(图像)的模式.我想出了上传部分,但对存储和服务部分有点困惑.
我对如何使用"Ok.sendFile"在单个页面上显示本地存储的图像感到困惑.如何将它绑定到视图中的"img src"标签?我能想到的另一个选择是在本地运行(单独的)Web服务器只是为了存储文件,这没有多大意义.