注释org.springframework.web.bind.annotation.CrossOrigin缺少值

对于属性, 注释org.springframework.web.bind.annotation.CrossOrigin缺少值

使用idea在install maven应用时,遇到以上问题,需要修改jdk版本;

经过网上一顿修改jdk操作后,还是无法正常install的,请在操作一下这个位置:

在这里插入图片描述

~

只有修改这里才能解决本质问题!!!

package com.ischoolbar.programmer.controller; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.ischoolbar.programmer.entity.Clazz; import com.ischoolbar.programmer.entity.Grade; import com.ischoolbar.programmer.page.Page; import com.ischoolbar.programmer.service.ClazzService; import com.ischoolbar.programmer.service.GradeService; import com.ischoolbar.programmer.util.StringUtil; /** * 班级信息管理 * @author llq * */ @RequestMapping("/clazz") @Controller public class ClazzController { @Autowired private GradeService gradeService; @Autowired private ClazzService clazzService; /** * 班级列表页 * @param model * @return */ @RequestMapping(value="/list",method=RequestMethod.GET) public ModelAndView list(ModelAndView model){ model.setViewName("clazz/clazz_list"); List<Grade> findAll = gradeService.findAll(); model.addObject("gradeList",findAll ); model.addObject("gradeListJson",JSONArray.fromObject(findAll)); return model; }给这段代码加上注释
06-03
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @Service public class DeepSeekService { @Autowired private RestTemplate restTemplate; @Autowired private DeepSeekConfig deepSeekConfig; private final ObjectMapper objectMapper = new ObjectMapper(); public String askDeepSeek(String question) throws JsonProcessingException { DeepSeekRequest request = new DeepSeekRequest(); request.setModel("deepseek-chat"); request.setStream(false); List<DeepSeekRequest.Message> messages = List.of( new DeepSeekRequest.Message("user", question) ); request.setMessages(messages); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAuthorization("Bearer " + deepSeekConfig.getApiKey()); HttpEntity<String> entity = new HttpEntity<>(objectMapper.writeValueAsString(request), headers); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(deepSeekConfig.getApiUrl()); ResponseEntity<String> response = restTemplate.postForEntity(builder.toUriString(), entity, String.class); if (response.getStatusCode().is2xxSuccessful()) { DeepSeekResponse deepSeekResponse = objectMapper.readValue(response.getBody(), DeepSeekResponse.class); if (deepSeekResponse != null && deepSeekResponse.getChoices() != null && !deepSeekResponse.getChoices().isEmpty()) { return deepSeekResponse.getChoices().get(0).getDelta().getContent(); } } return "No valid response from DeepSeek"; } } import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.http.ResponseEntity; @RestController public class DeepSeekController { @Autowired private DeepSeekService deepSeekService; @GetMapping("/ask") public ResponseEntity<String> askDeepSeek(@RequestParam String question) { try { String response = deepSeekService.askDeepSeek(question); return ResponseEntity.ok(response); } catch (Exception e) { return ResponseEntity.status(500).body("Error occurred while communicating with DeepSeek: " + e.getMessage()); } } } 根据以上代码帮我生成一个Vue2的deepseek对话页面代码
04-01
``` package com.ljs.pojectTest.controller; import com.ljs.pojectTest.dto.para.ParaProductPricegroupMateria; import com.ljs.pojectTest.dto.result.ResultProductPricegroupMateria; import com.ljs.pojectTest.service.ProductPricegroupMateriaService; import com.ljs.pojectTest.vo.Result; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; @RestController @RequestMapping("/api/material") public class ProductPricegroupMateriaController { @Resource private ProductPricegroupMateriaService materiaService; /** * 多条件组合查询中板信息 * @param queryParam 包含以下任意组合的查询参数: * 1. categoryId - 分类ID(精确匹配) * 2. materialName - 物料名称(模糊匹配) * 3. priceGroup - 价格分组(精确匹配) * @return 统一格式的响应结果,包含查询到的中板信息列表 */ @PostMapping("/query") public Result<List<ResultProductPricegroupMateria>> queryMaterials( @RequestBody ParaProductPricegroupMateria queryParam) { // 调用Service层进行条件查询 List<ResultProductPricegroupMateria> resultList = materiaService.queryByConditions(queryParam); // 包装统一响应格式(假设Result是预定义的响应包装类) return Result.success(resultList); } }```根据代码封装一个Result类
04-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值