小编Has*_*ral的帖子

Spring Security中始终拒绝访问 - DenyAllPermissionEvaluator

我在Spring Boot应用程序中配置了ACL.ACL配置如下:

@Configuration
@ComponentScan(basePackages = "com.company")
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class ACLConfigration extends GlobalMethodSecurityConfiguration {

    @Autowired
    DataSource dataSource;

    @Bean
    public EhCacheBasedAclCache aclCache() {
        return new EhCacheBasedAclCache(aclEhCacheFactoryBean().getObject(), permissionGrantingStrategy(), aclAuthorizationStrategy());
    }

    @Bean
    public EhCacheFactoryBean aclEhCacheFactoryBean() {
        EhCacheFactoryBean ehCacheFactoryBean = new EhCacheFactoryBean();
        ehCacheFactoryBean.setCacheManager(aclCacheManager().getObject());
        ehCacheFactoryBean.setCacheName("aclCache");
        return ehCacheFactoryBean;
    }

    @Bean
    public EhCacheManagerFactoryBean aclCacheManager() {
        return new EhCacheManagerFactoryBean();
    }

    @Bean
    public DefaultPermissionGrantingStrategy permissionGrantingStrategy() {
        ConsoleAuditLogger consoleAuditLogger = new ConsoleAuditLogger();
        return new DefaultPermissionGrantingStrategy(consoleAuditLogger);
    }

    @Bean
    public AclAuthorizationStrategy aclAuthorizationStrategy() {
        return new AclAuthorizationStrategyImpl(new SimpleGrantedAuthority("ROLE_ACL_ADMIN"));
    } …
Run Code Online (Sandbox Code Playgroud)

java spring acl spring-security spring-boot

19
推荐指数
2
解决办法
6516
查看次数

java.lang.NoSuchMethodError:org.apache.logging.log4j.Logger.atDebug() 与 poi-ooxml

我有:

<dependencies>

        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-xml</artifactId>
            <version>2.13.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-jaxb-annotations -->
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
            <version>2.13.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.2.2</version>
        </dependency>

        <dependency>
            <groupId>com.company.commons</groupId>
            <artifactId>commons-batch</artifactId>
            <version>${company.commons.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.8</version>
        </dependency>

        <dependency>
            <groupId>com.company.project</groupId>
            <artifactId>project-domain</artifactId>
            <version>0.1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
Run Code Online (Sandbox Code Playgroud)

company-commons我有:

<dependencies>
        <dependency>
            <groupId>com.company.commons</groupId>
            <artifactId>company-domain</artifactId>
            <version>2.9.0-SNAPSHOT</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-quartz -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-quartz</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-batch -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-batch</artifactId>
            <version>${spring.boot.version}</version>
        </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

我有company-domain

<dependencies>

        <!-- https://mvnrepository.com/artifact/org.zalando/problem-spring-web-starter -->
        <dependency>
            <groupId>org.zalando</groupId>
            <artifactId>problem-spring-web</artifactId>
            <version>0.27.0</version>
        </dependency> …
Run Code Online (Sandbox Code Playgroud)

spring log4j spring-batch spring-boot

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

Angular对ng-src中的url进行编码,并用%2F和'?'替换'/' 与%3F

我有一个带URL的Kibana仪表板:

/logquery/app/kibana#/dashboard/Some-Dashboard?someParameters
Run Code Online (Sandbox Code Playgroud)

我有一个Web应用程序,我试图在上面嵌入仪表板<iframe>.Web应用程序中的URL如下所示

/dashboards/logquery/app/kibana#/dashboard/Some-Dashboard?someParameters
Run Code Online (Sandbox Code Playgroud)

在AngularJs中,我正在做:

ctrl.dashboardUrl = $location.url().replace('/dashboards', '');
Run Code Online (Sandbox Code Playgroud)

在我看来:

<div ng-controller="DashboardCtrl as ctrl">
    <div class="iframe-container">
        <iframe ng-src="{{ctrl.dashboardUrl | trustAsUrl}}"
                height="100%"
                width="100%"
                ng-cloak
                frameborder="0"
                marginheight="0"
                marginwidth="0"></iframe>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

trustAsUrl 过滤器如下:

filtersGroup.filter('trustAsUrl', [
    '$sce',
    function ($sce) {
        return function (val) {
            return $sce.trustAsResourceUrl(val);
        };
    }]);
Run Code Online (Sandbox Code Playgroud)

我有:

$locationProvider.html5Mode({
                enabled: true,
                requireBase: false,
                rewriteLinks: false
            });
Run Code Online (Sandbox Code Playgroud)

这会导致/后面的字符/kibana#与被替换%2F,并?%3F导致Kibana没有能够找到所需的仪表板.

我怎么能克服这个?谢谢!

javascript encoding urlencode angularjs kibana

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

游戏中心无法为多个玩家ID加载照片

我通过在函数中使用以下代码递归地在自定义排行榜中加载照片:

-(void)loadPhotos {
 [((GKPlayer*)[players objectAtIndex:i]) loadPhotoForSize:GKPhotoSizeSmall withCompletionHandler: ^(UIImage *photo, NSError *error) {

            if (error != nil)
            {

                NSLog(@"Error: %@", error);
            }
            if (photo != nil)
            {   

                [friendPhotos addObject:photo];
                [globalTable reloadData];
                i++;
                if (i< [players count]){
                    [self loadPhotos];
                }
            }
        }];
}
Run Code Online (Sandbox Code Playgroud)

我们目前正在两个设备上测试应用程序,因此我们在沙盒环境中有2个玩家.但是,第一个播放器的第一个呼叫加载照片,但第二张照片,我无法加载,我打印以下错误:

Error: Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x1b19f0 {NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server.}
Run Code Online (Sandbox Code Playgroud)

有什么建议?

PS.也在循环中迭代地尝试了它.同样的错误,我认为这是因为我过于频繁地打电话.

iphone xcode center objective-c

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

有没有办法跳过仅针对特定作业的 Spring Batch 持久元数据?

有几个示例说明我们如何在不将元数据持久化到数据库的情况下使用 Spring Batch。以下是有关此事的一些示例和相关问题:

但是我有一个稍微不同的用例:我有一些工作每小时运行一次,我想将元数据保存到我的数据库中(例如,创建报告,运行一些测试,这两者在处理过程中可能有点繁重)。我有一些其他类型的作业每分钟左右运行一次(例如解锁由于重复输入错误密码而被锁定的用户帐户等),它们不涉及太多处理,而是一个简单的 sql 查询。

这里的问题分为两部分:

  1. 有没有办法将第一类作业(例如报告处理)的元数据保留在数据库中,而对第二类作业(例如解锁用户帐户)根本不使用数据库持久性?

  2. 或者,甚至将 Spring Batch 用于第二类工作是否会矫枉过正/根本不需要?带@Scheduled注释的方法就足够了吗?

spring spring-batch spring-boot

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

科科斯2d与否?

这是一个决策问题.

我们正在构建一个词汇应用程序.有一个计时器,用户应该在计时器关闭之前选择一个单词的正确同义词等.在计时器关闭或用户选择并回答之后,显示正确答案,然后显示下一个单词.图形不多,只有一些很酷的图像,还有计时器等.

我们应该只使用标准的UIViewController方法,还是更好地使用Cocos 2d库,或类似的东西?

iphone xcode objective-c cocos2d-iphone ipad

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

maven-jaxb2-plugin失败,JAXB版本属性必须存在

我有以下配置maven-jaxb2-plugin:

            <!-- https://mvnrepository.com/artifact/org.jvnet.jaxb2.maven2/maven-jaxb2-plugin -->
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>0.13.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <strict>false</strict>
                    <schemaLanguage>WSDL</schemaLanguage>
                    <generatePackage>com.mycompany.project.domain.wsdl</generatePackage>
                    <schemas>
                        <schema>
                            <url>url or file</url>
                        </schema>
                    </schemas>
                </configuration>
            </plugin>
Run Code Online (Sandbox Code Playgroud)

它失败了:

[ERROR] Error while parsing schema(s).Location [ file:/home/hasancansaral/workspace/company/domain/src/main/xsd/delivery.wsdl{2,366}].
Run Code Online (Sandbox Code Playgroud)

org.xml.sax.SAXParseException; systemId:file:/home/hasancansaral/workspace/company/domain/src/main/xsd/delivery.wsdl; lineNumber:2; columnNumber:366; 必须存在JAXB版本属性

如果我通过IntelliJ IDEA运行插件或做一个简单的操作,它没有什么区别mvn clean jax2b:generate.但是,使用可在此处找到的架构的操作是成功的,因此我怀疑我的wsdl架构实际上是格式错误的,我暂时无法公开,但可以通过消息提供(我知道它没有多大帮助按原样公开,但如果问题出现在模式中,我将在此处发布相关的问题部分).

注意: SOAP UI也会验证架构.

注2: 同样的错误是存在既jax2b-maven-pluginmaven-jax2b-plugin.

jaxb maven-plugin maven maven-jaxb2-plugin jaxb2-maven-plugin

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

@Cacheable 不拦截方法,缓存始终为空

我有一个方法如下:

@Cacheable(value = "SAMPLE")
public List<SomeObj> find() {
     // Method that initiates and returns the List<SomeObj> and takes around 2-3 seconds, does some logging too
}
Run Code Online (Sandbox Code Playgroud)

我正在我的配置类之一中启用缓存:

@EnableCaching
@Configuration
public SomeConf extends CachingConfigurerSupport {

    // Here I also initialize my classes with @Cacheable annotation

    @Bean
    @Override
    public CacheManager cacheManager() {
        SimpleCacheManager cacheManager = new SimpleCacheManager();
        cacheManager.setCaches(Collections.singletonList((new ConcurrentMapCache("SAMPLE"))));
        return cacheManager;
    }


    @Bean
    @Override
    public CacheResolver cacheResolver() {
        return new SimpleCacheResolver(cacheManager());
    }

    @Bean
    @Override
    public KeyGenerator keyGenerator() {
        return new SimpleKeyGenerator();
    } …
Run Code Online (Sandbox Code Playgroud)

java spring caching spring-boot spring-cache

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

启动 resourceHandlerMapping bean 时未设置 ServletContext

我在启动 Spring Boot 1.5.14 应用程序时收到此错误:


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcHandlerMappingIntrospector' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-boot

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

AWS Fargate 集群无法使用 NAT 和 Internet 网关访问 Internet

我正在尝试将容器部署到 AWS 上的专用网络 Fargate 集群。我的单个 VPC 上确实有一个 Internet 网关:

互联网网关

我在集群/服务所在的同一 VPC 中确实有一个针对该特定子网的 NAT 网关:

NAT网关

该子网的路由似乎也可以:

子网路由

并且该服务的安全组不会阻止任何传入连接:

安全组

安全组入站

但我的容器甚至没有以臭名昭著的异常启动:CannotPullContainerError: 来自守护进程的错误响应:Get https://registry-name/: net/http: request Canceled while waiting for connection (Client.Timeout Exceeded while waiting headers)为什么?谢谢。

amazon-web-services amazon-ecs amazon-ecr aws-fargate

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