小编ebi*_*ebi的帖子

始终运行带有failOnError ="false"的Liquibase changeSet?

我正在尝试changeSet在liquibase中执行以下操作,它应该创建一个索引.如果索引不存在,它应该静默失败:

<changeSet failOnError="false" author="sys" id="1">
    <createIndex unique="true"  indexName="key1" tableName="Table1">
        <column name="name" />
    </createIndex>
</changeSet>
Run Code Online (Sandbox Code Playgroud)

到现在为止还挺好.问题是,这changeSet不会记录到DATABASECHANGELOG表中,因此每次liquibase运行时都会执行此操作.根据liquibase文档和例如Nathen Voxland的回答,我认为变更集应该在DATABASECHANGELOG表中标记为ran.相反它根本没有记录,正如我之前说的每次liquibase运行时都会执行(并且每次都会失败).

我错过了什么吗?

(我使用MySQL作为DBMS)

sql database-migration liquibase database-schema

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

如何在分布在多个文件中的 Spring Security 中订购多个 &lt;http&gt; 元素

在 Spring Security 中,可以指定<http>导致多个 SecurityFilterChains 的多个配置。我使用该功能来保护与普通 Web 应用程序不同的 Rest API。web app 和rest api 都是在不同的模块(maven artifacts)中开发的。Spring 配置通过通配符模式在整个类路径 ( classpath*:/some-common-config-path/*.xml)中收集。

中 Web 应用程序的安全配置web-security-config.xml

<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://cxf.apache.org/configuration/beans http://cxf.apache.org/schemas/configuration/cxf-beans.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

  <!-- Security Config for web app -->
  <http use-expressions="true" auto-config="false" entry-point-ref="loginEntryPoint">
       ...
  </http>

  <!-- Security Config for static resources -->
  <http pattern="/static/**" security="none" />

  ...

</beans:beans>
Run Code Online (Sandbox Code Playgroud)

中 Rest API 的安全配置api-security-config.xml

<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://cxf.apache.org/configuration/beans http://cxf.apache.org/schemas/configuration/cxf-beans.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

  <http pattern="/api/**" …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

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