两个值都相同,但为什么if判断是false

问题遇到的现象和发生背景

springboot 我向数据库获取了用户密码,和api传递的参数进行判断。但结构为false。我单独输出出来结果也是一样的。求解!

问题相关代码,请勿粘贴截图
package com.example.demo.content;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
//跨域问题
@CrossOrigin

public class content {
    @Autowired
    JdbcTemplate jdbcTemplate;

    @GetMapping("/login")
//    传递两个参数
    public Object login(@RequestParam(value = "username", required = true) String username, @RequestParam(value = "userpwd", required = true) String userpwd) {
//        设置sql语句
        String sql = "select * from userdata where username = " + "'" + username + "'";
//        执行sql语句并返回map
        Map<String, Object> map = jdbcTemplate.queryForMap(sql);
//        两值
        System.out.println(userpwd + "----" + map.get("userpwd"));
//        判断密码是否正确
        if (userpwd == map.get("userpwd")) {
            return true;
        } else {
            return false;
        }
    }
}
运行结果及报错内容

img

img

img

我的解答思路和尝试过的方法
我想要达到的结果

false 那就是密码不正确,检查检查密码相关的是否错误

img

以上仅供参考,希望对题主有所帮助!