小编Bla*_*nka的帖子

spring security Rest API错误-403禁止

我在 Spring Boot 项目上使用 Spring security,并且我尝试使用我的控制器的端点,但是当我从我的 js 进行调用时,我收到错误:403 forbidden。

我的安全配置:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .authorizeRequests()
            .antMatchers("/resources/**").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin()
            .loginPage("/login/")
            .defaultSuccessUrl("/inicio/")
            .usernameParameter("username").passwordParameter("password")
            .permitAll()
            .and()
            .logout().logoutSuccessUrl("/login/")
            .permitAll();
}

  @Override
  public void configure(AuthenticationManagerBuilder auth) throws    Exception   {
      auth
          .userDetailsService(userDetailsService)
          .passwordEncoder(new BCryptPasswordEncoder());

}
Run Code Online (Sandbox Code Playgroud)

我的控制器端点:

 @RequestMapping( value="/getUsuarios")
 @ResponseBody
public UsuarioTo getUsuarios( Model model) throws Exception {
    UsuarioTo to = getTo();

    try
    {
        to.setListaUsuario(usuarioRepository.findAll());
    }catch (Exception e)
    {
        throw new  Exception("Error al obtener los usuarios "+e.getMessage() );
    }


    return to; …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

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

Dart 中的多级地图或地图列表?

我有一个这样的位置数据地图:

{
  'country': 'Japan',
  'city': 'Tokyo',
  'Latitude': 35.6762,
  'Longitude': 139.6503,
  'utcOffset': 9
}
Run Code Online (Sandbox Code Playgroud)

女巫是存储这些数据的正确解决方案,为什么?

1)地图列表:

List<Map<String, dynamic>> locations = [
 {
      'country': 'Japan',
      'city': 'Tokyo',
      'Latitude': 35.6762,
      'Longitude': 139.6503,
      'utcOffset': 9
    }
];
Run Code Online (Sandbox Code Playgroud)

或多级数据对象

var locations = {
{
      'country': 'Egypt',
      'city': 'Cairo',
      'Latitude': 30.033333,
      'Longitude': 31.233334,
      'utcOffset': 2
    },
    {
      'country': 'Thailand',
      'city': 'Bangkok',
      'Latitude': 13.7563,
      'Longitude': 100.5018,
      'utcOffset': 7
    },
};
Run Code Online (Sandbox Code Playgroud)

以及如何访问这两种情况下的数据?

dart flutter

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

检索满足条件的项目

这是我的模型课:

class Contact {
  String name;
  String email;
  int phoneNo;

  Contact(this.name, this.email, this.phoneNo);
}
Run Code Online (Sandbox Code Playgroud)

假设我有如下的联系人列表:

List<Contact> contacts = [
  new Contact('John', 'john@c.com', 002100),
  new Contact('Lily', 'lily@c.com', 083924),
  new Contact('Abby', 'abby@c.com', 103385),
];
Run Code Online (Sandbox Code Playgroud)

我想从获取John电话号码contacts List,该怎么办?

dart

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

如何在laravel中为日期添加分钟

我可以使用 PHP 执行此操作的方法很少,但是我找不到使用 Laravel 特定方式执行此操作的方法。

我有一个时间来自以下格式的数据库: Y:M:s

前任: 05:15:00

这就是我想要做的:

30 分钟添加到该日期,根据上面的示例结果应该是:05:45:00

以下是我当前的代码,我想将 30 分钟添加到$endTime

//get database value according to selected date
$allocatedDateQuery = DB::table('appointments')->where('date', $request->date)->get();

//loop throug every record to get time
foreach ($allocatedDateQuery as $value) {
    $time = $value->time;
    $endTime = $time;
}
Run Code Online (Sandbox Code Playgroud)

time laravel

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

解析 flutter/dart 中的数字

I'm trying to parse the string "78,74"(which is a valid number in Brazil's format) to double, but I'm getting Format Exception and I can't find any way to parse it... Already searched in intl docs but there's nothing helpful.

I don't want to replace the "," with "." because i think that it must be a way to parse it using CultureInfo

My code is like

String x = "78,74";

double d = double.tryParse(x)
Run Code Online (Sandbox Code Playgroud)

double parsing dart flutter

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

为什么文字有黄色下划线,字体大?

代码截图和结果:

在此处输入图片说明

嗨,我有StatelessWidget已经Container在它的构建方法返回与Text小部件的子部件。但它的外观和感觉并不像预期的那样。为什么是yellow下划线,如何删除它?

我试着更换ContainerStackColumnRow没有什么变化。

text underline flutter yellow flutter-layout

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

Java Iterator进入无限while循环

我试图用iterator一会儿迭代列表,由于某种原因,它会无限循环。

这是代码

{
List<Person> Person1 = new ArrayList<Person>();

    Person p1 = new Person("Name1", "Virginia");

    Person1.add(new Person("Nae2", "Virginia"));

    printerlist(Person1);

    printerlist(p1);

}

private static void printerlist(List<Person> p) {

    /*
     * print the list
     */
    while (p.iterator().hasNext()) {
        System.out.println(p.iterator().next().getCity());
    }

}
Run Code Online (Sandbox Code Playgroud)

java arraylist

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

Python - 如何在列表中查找数字

......小于或等于另一个数字?

例如,

a = [2, 5, 6, 9]
b = 3
Run Code Online (Sandbox Code Playgroud)

如何在列表中获得小于或等于3的数字a

python list

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