小编Abd*_*dul的帖子

@SpringBootApplication无法解析为STS中的类型

我对STS很新.我在stackoverflow中搜索了这个错误.我找不到正确的匹配答案.

我能够在STS中看到MavenDependencies中的类,但是无法在我的java类中添加注释.

在此输入图像描述 你的帮助将得到满足.谢谢

在此输入图像描述

java spring spring-tool-suite spring-boot

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

春天无法返回带有异常详细信息的ResponseEntity

我创建了一个Spring Restful Service和Spring MVC应用程序。

Restful Service :: Restful Service返回一个实体(如果它存在于数据库中)。如果不存在,则在ResponseEntity对象中返回自定义Exception信息。

它正在使用邮递员进行预期的测试。

@GetMapping(value = "/validate/{itemId}", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public ResponseEntity<MyItem> validateItem(@PathVariable Long itemId, @RequestHeader HttpHeaders httpHeaders) {

    MyItem myItem = myitemService.validateMyItem(itemId);
    ResponseEntity<MyItem> responseEntity = null;
    if (myItem == null) {
        throw new ItemNotFoundException("Item Not Found!!!!");
    }
    responseEntity = new ResponseEntity<MyItem>(myItem, headers, HttpStatus.OK);
    return responseEntity;
}
Run Code Online (Sandbox Code Playgroud)

如果所请求的实体不存在,Restful Service将在下面返回。

@ExceptionHandler(ItemNotFoundException.class)
public ResponseEntity<ExceptionResponse> itemNotFEx(WebRequest webRequest, Exception exception) {
    System.out.println("In CREEH::ItemNFE");
    ExceptionResponse exceptionResponse = new ExceptionResponse("Item Not Found Ex!!!", new Date(), webRequest.getDescription(false));
    ResponseEntity<ExceptionResponse> …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-boot spring-rest

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

Spring 事件与 ActiveMQ

新手来到 Spring 世界。我对ActiveMQ有一些了解。最近在我的一个项目中使用。在阅读有关春季活动的信息时提出了疑问。

Spring 事件:发布者 -> 监听器。我们确实发布了事件,并且我们会为此创建一些监听器。

ActiveMQ:发布者->监听器。我们确实发布了事件,并且我们会为此创建一些监听器。

所以任何人都可以帮助我理解这两个 API 的用例或区别。

spring activemq-classic jms

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

如何从java程序向手机发送短信-使用免费的API或WebServices

我需要编写一个程序,应该能够通过java编程向手机发送短信。到目前为止我所知道的是使用短信网关并将调制解调器与 SIM 卡连接。

但我无法在客户端计算机上安装 SMS 网关和调制解调器。我可以使用smtp主机吗?

How can i use Web Service to send sms?
Run Code Online (Sandbox Code Playgroud)

我们将非常感谢您的时间和贡献。

java sms web-services sms-gateway

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

如何在Spring MVC中的jsp文件中显示图像

我对春天很新。我使用的是Spring 3.29版本的tomcat7。我需要在.jsp文件中显示图像。我搜了很多。有关此问题的文章很多。但是我仍然无法解决这个问题。请帮忙。

以下是我的应用程序结构

以下是我的应用程序结构

以下是我的spring-servlet.xml文件代码

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd  
        http://www.springframework.org/schema/context  
        http://www.springframework.org/schema/context/spring-context-3.2.xsd
        http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

    <context:component-scan base-package="com.wipro.controller" />
    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass">
            <value>
                org.springframework.web.servlet.view.tiles2.TilesView
            </value>
        </property>
    </bean>
    <bean id="tilesConfigurer"
        class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles.xml</value>
            </list>
        </property>
    </bean>
</beans>
Run Code Online (Sandbox Code Playgroud)

我有一个footer.jsp页面。我需要在此文件中添加图像,下面是代码

<!-- Here I need to add an image -->
<hr/>  
<p>Copyright  2010-2014 javatpoint.com.</p>  
Run Code Online (Sandbox Code Playgroud)

spring jsp spring-mvc tiles2

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

如果我在main方法中执行Thread.sleep(10000),子线程会发生什么

我在for循环中创建了一些可调用的线程,在我的main方法中启动了所有这些线程.

启动所有线程后我有Thread.sleep(10000).在这种情况下,我的孩子可调用线程会发生什么.

psudocode:

    public static void main(String[] args){
        Map<String, String> columnNames_TypesMap = tableUtil.getColumnNamesAndTypesFromOracleDB(toTable);

        ExecutorService executor = Executors.newFixedThreadPool(50);

        Set<Future<String>> values = Collections.newSetFromMap(new ConcurrentHashMap<Future<String>, Boolean>());
        Future<String> value = null;
        boolean valueSizeLogged = false;
        long preValuesSize = values.size();

        outer: while (true) {
            //In the below method I am reducing values size.
            count = tableUtil.checkIfAllRowsCopied(values, count, totalNoOfRecordsInFromTable);

            if (values.size() > 5) {
                logger.info("****** Hence we do not create new threads. We do wait for the created threads to compelte");
                Thread.sleep(sleepTime);//Here I am …
Run Code Online (Sandbox Code Playgroud)

java multithreading android java-ee

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