小编Dhe*_*rik的帖子

liquibasechangeset顺序在后续更新中是否会更改?

liqibase中的CHANGESET执行是否取决于它在xml中的位置?例如,如果我有一个liquibase脚本,如下所示

<changeSet id="20140211_001" author="test">
    <createTable tableName="alarm_notification_archive">
        <column name="id" type="bigint">
            <constraints nullable="false" />
        </column>

        <column name="event_timestamp" type="timestamp" defaultValue="0000-00-00 00:00:00">
            <constraints nullable="false" />
        </column>
    </createTable>
</changeSet>

<changeSet id="20140210_001" author="test">
    <sql>ALTER TABLE `notification_archive` ADD COLUMN
        `is_Alarm_Outstanding` BOOLEAN DEFAULT FALSE</sql>
    <rollback>
        <sql>ALTER TABLE notification_archive DROP COLUMN
            is_Alarm_Outstanding
                </sql>
    </rollback>
</changeSet>
Run Code Online (Sandbox Code Playgroud)

我的理解是changeset排序是:

  1. 20140211_001
  2. 20140210_001

如果我现在在1和2之间添加另一个变更集

<changeSet id="20140211_001" author="test">
    <createTable tableName="alarm_notification_archive">
        <column name="id" type="bigint">
            <constraints nullable="false" />
        </column>

        <column name="event_timestamp" type="timestamp" defaultValue="0000-00-00 00:00:00">
            <constraints nullable="false" />
        </column>
    </createTable>
</changeSet>

<changeSet id="20140212_001" author="test">
    <sql>ALTER TABLE …
Run Code Online (Sandbox Code Playgroud)

mysql liquibase

2
推荐指数
1
解决办法
4018
查看次数

Spring上的-Drun.profiles和-Dspring.profiles.active有什么区别?

我试图理解 Spring 和 之间的-Drun.profiles区别-Dspring.profiles.active

SO 中的另一个答案并没有过多解释其中的差异。

在我的测试中,它们都可以用来选择配置文件:

mvn spring-boot:run -Drun.profiles=prod
Run Code Online (Sandbox Code Playgroud)

或者

mvn spring-boot:run -Dspring.profiles.active=prod
Run Code Online (Sandbox Code Playgroud)

那么,有什么区别呢?

java profile spring maven spring-boot

2
推荐指数
1
解决办法
2754
查看次数

spring 集成测试启动缓慢。原因?无法禁用 RabbitMQ

我的集成测试在启动时遇到了性能问题。

我正在尝试模拟系统的消息传递。为此,我基本上@MockBean在我的网关上使用并使用@EnableAutoConfiguration(exclude = {RabbitAutoConfiguration.class}). 例子:

@RunWith(SpringRunner.class)
@SpringBootTest(classes = MyApplication.class)
@WebAppConfiguration
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@ActiveProfiles("test")
@EnableAutoConfiguration(exclude = {RabbitAutoConfiguration.class})
public class MyTestIT {
Run Code Online (Sandbox Code Playgroud)

这两个配置很好地完成了这项工作,我的测试运行没有问题,并且与某些外部 RabbitMQ 没有任何依赖关系。

但是spring boot的启动时间非常非常慢。这是大约两分钟只有在这部分配置SimpleMessageListenerContainerAmqpInboundChannelAdapterEventDrivenConsumerRabbitExchangeQueueProvisioner,等。

日志有一些关于问题所在的提示(我剪了很多消息,这是一个示例):

2018-02-09 14:26:37.784  INFO [ms-project-name-service,,,] 13804 --- [           main] o.s.integration.channel.DirectChannel    : Channel 'ms-project-name-service:test:-1.channel2-output' has 1 subscriber(s).

2018-02-09 14:26:54.110  INFO [ms-project-name-service,,,] 13804 --- [           main] c.s.b.r.p.RabbitExchangeQueueProvisioner : declaring queue for inbound: channel1-input.anonymous.417FtxKTTce7-_IR0tGuNA, bound to: channel1-input

2018-02-09 14:27:00.147  INFO [ms-project-name-service,,,] 13804 --- [           main] …
Run Code Online (Sandbox Code Playgroud)

spring integration-testing rabbitmq spring-boot spring-boot-test

2
推荐指数
1
解决办法
3738
查看次数

格式化日期字符串以删除JAVA中的时间

示例,字符串值为:

15/08/2013 15:30 GMT+10:00 
Run Code Online (Sandbox Code Playgroud)

我想15/08/2013在Java 上格式化上面的字符串(删除时间部分,只保留日期).

我该怎么做这种格式?

java string date

1
推荐指数
2
解决办法
1万
查看次数

如何使用Spring Boot设置SpringFox以显示Rest API的两个(或更多)版本?

我试图弄清楚如何使用Spring Fox管理两个(或更多)API端点版本。

要对API进行版本控制,我正在通过内容协商使用版本控制,也称为使用Accept标头的版本控制。使用标头信息分别控制每个端点的版本。例如,对于第一版,我使用属性produces

@Override
@PostMapping(
        produces = "application/vnd.company.v1+json")
public ResponseEntity<User> createUser(
Run Code Online (Sandbox Code Playgroud)

对于第二版,我使用:

@Override
@PostMapping(
        produces = "application/vnd.company.v2+json",
        consumes = "application/vnd.company.v2+json")
public ResponseEntity<User> createUserVersion2(
Run Code Online (Sandbox Code Playgroud)

我不使用consumes第一个(v1)版本,因此如果客户端仅application/json在通话中使用,则默认情况下将调用第一个版本。

我想在Swagger UI上显示两个版本。怎么做?

spring swagger spring-boot springfox

1
推荐指数
1
解决办法
848
查看次数

错误:无法在默认路径中找到 .env 文件

我最近转而使用 dev.env 和 test.env 作为使用 Javascript 的 REST API,但出现以下错误:

$ npm run dev
Run Code Online (Sandbox Code Playgroud)

错误:

Error: Failed to find .env file at default paths: [./.env,./.env.js,./.env.json]
    at getEnvFile 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! taskr@1.0.0 dev: `env-cmd ./config/dev.env nodemon src/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the taskr@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)

.env我应该修改文件的存储/访问方式吗?

javascript development-environment node.js

1
推荐指数
1
解决办法
2705
查看次数

java.lang.NoClassDefFoundError:freemarker/template/TemplateModelException

尝试HTML使用extentReportsjar 创建高级报告,但它丢失了以下错误.

java.lang.NoClassDefFoundError:freemarker/template/TemplateModelException

码:

public class XtentReport { 
   WebDriver driver; 
   ExtentReports report; 
   ExtentTest logger; 

@Test public void verifyXReport() { 
   report = new ExtentReports("D:\\Selenium_Reports\\AdvanceReport.html"); 
   logger=report.startTest("StartingTC"); driver= new FirefoxDriver();
   driver.manage().window().maximize(); logger.log(LogStatus.INFO,"Browser is up and running"); 
   driver.get("google.com"); 
   logger.log(LogStatus.PASS,"Test completed"); report.endTest(logger); 
   report.flush(); 
   } 
 } 
Run Code Online (Sandbox Code Playgroud)

selenium freemarker

0
推荐指数
1
解决办法
1万
查看次数

SchemaCollection 上的多个 XSD:schemaElement 不能为空?

我正在尝试SchemaCollection在我的 Web 服务配置中使用 。但是当我为此添加代码时,我收到此错误:

引起:java.lang.IllegalArgumentException:schemaElement 不能为空!您是否运行 afterPropertiesSet() 或将其注册为 Spring bean?

这个错误是什么意思?查看Spring 代码,与schemaElementXSD 上的有关,但我无法说出什么。

没有 schemaCollection,一切正常。

完整错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pedidos' defined in class path resource [br/com/company/rdt/config/WebServiceConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: schemaElement must not be null! Did you run afterPropertiesSet() or register this as a Spring bean?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1631) ~[spring-beans-4.3.20.RELEASE.jar:4.3.20.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.20.RELEASE.jar:4.3.20.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.20.RELEASE.jar:4.3.20.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.20.RELEASE.jar:4.3.20.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.20.RELEASE.jar:4.3.20.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.20.RELEASE.jar:4.3.20.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) …
Run Code Online (Sandbox Code Playgroud)

schema spring xsd soap web-services

0
推荐指数
1
解决办法
2315
查看次数

curl:如果状态为 200,如何返回 0?

当响应状态为 200 时,如何返回 0?

现在我可以使用以下命令获取状态,例如 200:

curl -LI http://google.com -o /dev/null -w '%{http_code}\n' -s
Run Code Online (Sandbox Code Playgroud)

但是我需要做的是将这 200 转为 return 0。

我怎样才能做到这一点?

我尝试了以下命令,但没有返回:

if [$(curl -LI http://google.com -o /dev/null -w '%{http_code}\n' -s) == "200"]; then echo 0
Run Code Online (Sandbox Code Playgroud)

linux bash shell curl

-3
推荐指数
2
解决办法
1万
查看次数