小编Jam*_*esB的帖子

无法将带有[]的索引应用于类型为`object'的表达式

这是我的代码:ArrayList的ArrayList,它返回一个float:

public ArrayList paredes=new ArrayList();   

public void Start()
{
    paredes[0] = RetornaEmArrayList(279,275,0,0,90);
    paredes[1] = RetornaEmArrayList(62,275,0,0,0);
    paredes[2] = RetornaEmArrayList(62,275,62,0,90);
    paredes[3] = RetornaEmArrayList(217,275,62,-62,0);
    paredes[4] = RetornaEmArrayList(62,275,279,0,90);
    paredes[5] = RetornaEmArrayList(41,275,279,0,0);
    paredes[6] = RetornaEmArrayList(279,275,320,0,9);
    paredes[7] = RetornaEmArrayList(320,275,0,-279,0);  

    for (int i = 0; i < paredes.Length; i++) {
        float a = (float)paredes[i][0];
        float b = (float)paredes[i][1];
        float c = (float)paredes[i][2];
        float d = (float)paredes[i][3];
        float e = (float)paredes[i][4];
    }
}

ArrayList RetornaEmArrayList(float a,float b,float c, float d, float e)
{
    ArrayList arrayList = new ArrayList(); …
Run Code Online (Sandbox Code Playgroud)

c# indexing arraylist object

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

我无法在eclipse luna IDE中创建新的web项目(找不到创建新的web项目)

我为Java EE开发人员下载了这个Eclipse Luna,如描述中所示,它支持Web应用程序.我找不到

file - > new - > other - > web projects

在这个版本中.我到处寻找并没有找到答案.

java eclipse java-ee

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

端点,Spring Security 配置返回:该方法无法确定模式是否为 Spring MVC

SecurityConfiguration 中的 SecurityFilterChain beans 返回此错误 我没有找到任何有关此方法的信息来解决该问题:

    @Configuration
    @EnableWebSecurity
    public class SecurityConfiguration {
        
          @Bean
            public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception {
                return  httpSecurity
                        .csrf(csrf -> csrf.disable())
                        .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
                        .authorizeHttpRequests(authorize -> authorize
                                .requestMatchers(HttpMethod.POST, "/auth/login").permitAll()
                                .requestMatchers(HttpMethod.POST, "/auth/register").permitAll()
                                .requestMatchers(HttpMethod.POST, "/product").hasRole("ADMIN")
                                .anyRequest().authenticated()
                        )
                        .build();
            }
    }
Run Code Online (Sandbox Code Playgroud)

引起:org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.security.web.SecurityFilterChain]:工厂方法“securityFilterChain”抛出异常并显示消息:此方法无法确定这些模式是否是Spring MVC模式。如果此端点是 Spring MVC 端点,请使用 requestMatchers(MvcRequestMatcher); 否则,请使用 requestMatchers(AntPathRequestMatcher)。

原因:java.lang.IllegalArgumentException:此方法无法确定这些模式是否是 Spring MVC 模式。如果此端点是 Spring MVC 端点,请使用 requestMatchers(MvcRequestMatcher); 否则,请使用 requestMatchers(AntPathRequestMatcher)。

spring-security spring-boot spring-framework-beans security-filter

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

接口特定属性

如何解决这个接口问题?我想在这个特定的类中我需要这个变量(和其他一些变量).

public interface Action
{
    void execute();
}

public A:Action
{ 
    public int misteriousNumber;  

    void execute()
    {
         int iUseMisteriousNumber = misteriousNumber;
    }   
}

public B:Action
{ 
    void execute()
    {
       //I use nothing.
    }   
}

//Some Class...
static void Main(string[] args)
{
    foreach(Action action in SecretRepositoryOfTheActions.actions)
    {
        if(action is A)
            (SomeTypeOfCasting to A)action.misteriousNumber=13;            
       action.execute();
    }
}
Run Code Online (Sandbox Code Playgroud)

只是'A'类有这个属性而不是其他Action类用来访问它(转换,而不是接口其他实现)?

c# interface

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