Skip to content

Suggestion to Make Executable Example #1

@ghost

Description

Hello,

I am working through Spring in Practice. Right now I'm on sip01, branch 4, SIP page 16. I have a suggestion, one outside the scope of the book, one about the code.

The first suggestion is to put enough in the pom to create an executable jar:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>com.springinpractice.ch01.ConsoleApp</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> 
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>  

Also about the code, it would be cool to allow the jar to read the csv from the jar in resources:

in CsvAccountDao.java

Instead of this:

    BufferedReader br = new BufferedReader(new FileReader(csvResource.getFile()));

This:

    BufferedReader br = new BufferedReader(new InputStreamReader(csvResource.getInputStream()));

Great book btw, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions